summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/emacs.el
blob: 7bfd5c1863348ebc7f7ab95bb7eb9ceac09c26db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)

(set-face-attribute 'default nil :height 50)

(require 'evil)
(evil-mode 1)

(global-subword-mode)
(global-undo-tree-mode)

(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "M-g") 'magit-status)
(global-set-key (kbd "M-?") 'vc-git-grep)

(setq backup-directory-alist `(("." . "~/.saves")))
(setq delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2
      version-control t)

(add-hook 'haskell-mode-hook 'haskell-indentation-mode)
(add-hook 'haskell-mode-hook 'subword-mode)
(add-hook 'haskell-mode-hook 'highlight-symbol-mode)
(add-hook 'haskell-mode-hook 'highlight-paretheses-mode)

(add-hook 'js-mode-hook 'highlight-symbol-mode)
(add-hook 'js-mode-hook 'highlight-parentheses-mode)
(defun my-js-mode-hook ()
  "Custom `js-mode' behaviours."
  (setq js-indent-level 2)
  )
(add-hook 'js-mode-hook 'my-js-mode-hook)

(setq notmuch-address-internal-completion '(received nil))
(setq notmuch-always-prompt-for-sender t)
(setq notmuch-command "notmuch-ssh")
(setq notmuch-crypto-process-mime t)
(setq notmuch-draft-tags '("+draft" "-inbox"))
(setq notmuch-fcc-dirs nil)
(setq notmuch-hello-sections '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches))
(setq notmuch-hello-thousands-separator " ")
(setq notmuch-identities '("gkleen@yggdrasil.li" "g@141.li" "kleen@cip.ifi.lmu.de" "Gregor.Kleen@stud.ifi.lmu.de" "G.Kleen@campus.lmu.de" "G.Kleen@lmu.de" "gregor.kleen@ifi.lmu.de" "uni2work@ifi.lmu.de" "gregor@kleen.li"))
(setq notmuch-message-headers '("Subject" "To" "Cc" "Date"))
(setq notmuch-message-replied-tags '("+replied" "-unread" "-inbox"))
(setq notmuch-saved-searches
      (quote
       ((:name "inbox" :query "tag:inbox" :key "i")
	(:name "unread" :query "tag:unread AND tag:inbox" :key "u")
	(:name "drafts" :query "tag:draft" :key "d")
	(:name "all mail" :query "date:month.." :key "a" :count-query "*")
	(:name "sent" :query "is:sent" :key "s" :count-query "is:sent")
      )))
(setq notmuch-search-oldest-first nil)
(setq notmuch-show-all-tags-list t)
(setq notmuch-show-logo nil)

(setq send-mail-function 'sendmail-send-it)
(setq mail-envelope-from 'header)
(setq mail-specify-envelope-from 't)
(setq mail-default-headers nil)
(setq message-default-headers "")
(setq message-default-mail-headers "")
(setq message-sendmail-envelope-from 'header)

(setq highlight-symbol-idle-delay 0)

(setq indent-tabs-mode nil)

(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)

(setq mail-host-address "sif.midgard.yggdrasil")
(setq user-full-name "Gregor Kleen")

(defun tell-emacsclients-for-buffer-to-die ()
  "Sends error exit command to every client for the current buffer."
  (interactive)
  (dolist (proc server-buffer-clients)
    (server-send-string proc "-error die")))

(defun kill-buffer-with-special-emacsclient-handling ()
  "Wrapper around kill-buffer that ensures tell-emacsclients-for-buffer-to-die is on the hooks"
  (interactive)
  (add-hook 'kill-buffer-hook 'tell-emacsclients-for-buffer-to-die nil t)
  (kill-buffer))

;; (global-set-key (kbd "C-x k") 'kill-buffer)

(defun install-emacsclient-wrapped-kill-buffer ()
  "Installs wrapped kill-buffer with special emacsclient handling.
Best not to install it unconditionally because the server is not
necessarily running."
  (interactive)
  (global-set-key (kbd "C-x k") 'kill-buffer-with-special-emacsclient-handling))

(add-hook 'server-switch-hook 'install-emacsclient-wrapped-kill-buffer)