blob: 6670e407222a77ec569e919ff6f3994fdb2da353 (
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
;; el-get setup
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(require 'el-get)
;; (unless (require 'el-get nil 'noerror)
;; (with-current-buffer
;; (url-retrieve-synchronously
;; "https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el")
;; (goto-char (point-max))
;; (eval-print-last-sexp)))
;; no own recipes so far
;;(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)
;; save installed packages
(setq my-packages
'(color-theme color-theme-sanityinc-tomorrow el-get undo-tree volatile-highlights yasnippet auctex mu4e))
(el-get 'sync my-packages)
;; perl disable autoindent
(defun perl-mode-disable-auto-indent ()
(local-unset-key (kbd "{"))
(local-unset-key (kbd "}"))
(local-unset-key (kbd ";"))
(local-unset-key (kbd ":")))
(add-hook 'perl-mode-hook 'perl-mode-disable-auto-indent)
(require 'octave)
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode))
;; Sets the syntax highlighting to the maximum amount of colorization.
(setq font-lock-maximum-decoration t)
;; spaces instead of tabs
(setq-default indent-tabs-mode nil)
;; show corresponding parentheses
(require 'paren)
(setq show-paren-style 'parenthesis)
(show-paren-mode +1)
; turn on line numbers
(global-linum-mode t)
(scroll-bar-mode -1)
(setq inhibit-startup-message t)
;; move to different window with arrow keys
(global-set-key (kbd "C-x <up>") 'windmove-up)
(global-set-key (kbd "C-x <down>") 'windmove-down)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(global-set-key (kbd "C-x <left>") 'windmove-left)
;; no toolbar
(tool-bar-mode -1)
;; Turn Semantic on
(semantic-mode 1)
;; Try to make completions when not typing
(global-semantic-idle-completions-mode 1)
;; Use the Semantic speedbar additions
(add-hook 'speedbar-load-hook (lambda () (require 'semantic/sb)))
;; auto-complete
;; (require 'auto-complete)
;; (add-to-list 'ac-dictionary-directories "/usr/share/auto-complete/dict/")
;; (require 'auto-complete-config)
;; (ac-config-default)
;; recent files
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; enable better buffer switching
(require 'ido)
(ido-mode 'buffers) ;; only use this line to turn off ido for file names!
(setq ido-ignore-buffers '("^ " "*Completions*" "*Shell Command Output*"
"*Messages*" "Async Shell Command"))
(icomplete-mode 99)
;; for mail
(require 'mu4e)
;; gpg
(add-hook 'mu4e-compose-mode-hook 'epa-mail-mode)
(add-hook 'mu4e-view-mode-hook 'epa-mail-mode)
;; in order to read send mail
(setq mml2015-encrypt-to-self t)
(setq mml2015-sign-with-sender t)
;; default
(setq mu4e-maildir (expand-file-name "~/Maildir"))
;; don't save message to Sent Messages, GMail/IMAP will take care of this
;;(setq mu4e-sent-messages-behavior 'delete)
;; allow for updating mail using 'U' in the main view:
(setq mu4e-get-mail-command "offlineimap -a wolfi,postmaster,postmaster_vps"
mu4e-update-interval 300)
;; don't keep message buffers around
(setq message-kill-buffer-on-exit t)
;; the headers to show in the headers list -- a pair of a field
;; and its width, with `nil' meaning 'unlimited'
;; (better only use that for the last field.
(setq mu4e-headers-fields
'( (:human-date . 12)
(:flags . 6)
(:from-or-to . 22)
(:subject . nil)))
;; Don't prompt for applying of marks, just apply
(setq mu4e-headers-leave-behavior 'apply)
;; sending mail -- replace USERNAME with your gmail username
;; also, make sure the gnutls command line utils are installed
;; package 'gnutls-bin' in Debian/Ubuntu, 'gnutls' in Archlinux.
(require 'smtpmail)
;;(require 'starttls)
;; for cert pinning
(if (fboundp 'gnutls-available-p)
(fmakunbound 'gnutls-available-p))
;; function for choosing account
(defun my-mu4e-set-account ()
"Set the account for composing a message."
(let* ((account
(if mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir))
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(lambda (var) (car var))
my-mu4e-account-alist "/"))
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
nil t nil nil (caar my-mu4e-account-alist))))
(account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error "No email account found"))))
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
(autoload 'footnote-mode "footnote" nil t)
;;(add-hook 'mu4e-compose-mode-hook 'footnode-mode)
(add-hook 'message-mode-hook 'footnote-mode)
;; add flagged filter
(add-to-list 'mu4e-bookmarks
'("flag:flagged" "starred" ?s))
;; further general options for mail
;; fetches images without asking?
;;(setq mu4e-view-show-images t)
;; (when (fboundp 'imagemagick-register-types)
;; (imagemagick-register-types))
;; converting destroys umlauts and new shr2text not yet available
;;(setq mu4e-html2text-command "html2text -utf8 -width 72")
;;(require 'mu4e-contrib)
;;(setq mu4e-html2text-command 'mu4e-shr2text)
(defun my-render-html-message ()
(let ((dom (libxml-parse-html-region (point-min) (point-max))))
(erase-buffer)
(shr-insert-document dom)
(goto-char (point-min))))
(setq mu4e-html2text-command 'my-render-html-message)
;;(setq mu4e-html2text-command "w3m -dump -T text/html")
(setq mu4e-view-prefer-html t)
(setq mu4e-use-fancy-chars t)
(setq mail-user-agent 'mu4e-user-agent)
(setq mu4e-hide-index-messages t)
;; use dired to attach multiple files
(require 'gnus-dired)
;; make the `gnus-dired-mail-buffers' function also work on
;; message-mode derived modes, such as mu4e-compose-mode
(defun gnus-dired-mail-buffers ()
"Return a list of active message buffers."
(let (buffers)
(save-current-buffer
(dolist (buffer (buffer-list t))
(set-buffer buffer)
(when (and (derived-mode-p 'message-mode)
(null message-sent-message-via))
(push (buffer-name buffer) buffers))))
(nreverse buffers)))
(setq gnus-dired-mail-mode 'mu4e-user-agent)
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
;; spell check
(add-hook 'mu4e-compose-mode-hook
(defun my-do-compose-stuff ()
"My settings for message composition."
(set-fill-column 72)
(flyspell-mode)))
;; cache keys
(setq epa-file-cache-passphrase-for-symmetric-encryption t)
(defun print-vevent (msg attachnum)
"nicely print vevent attachment."
(concat "vcp.pl -f" msg attachnum))
;; defining 'c' as the shortcut
(add-to-list 'mu4e-view-attachment-actions
'("cprint vevent" . print-vevent) t)
;; change dictionaries
(defun fd-switch-dictionary()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "deutsch8") "english" "deutsch8")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))
(global-set-key (kbd "<f8>") 'fd-switch-dictionary)
;; start mu4e
(global-set-key (kbd "<f6>") 'mu4e)
;; default save before compile
(setq compilation-ask-about-save nil)
;; scroll compilation buffer
;;(setq compilation-scroll-output t)
;; compile shortcut
(global-set-key (kbd "<f7>") 'compile)
;; I like M-g for goto-line
(global-set-key "\M-g" 'goto-line)
;; open files as root
(require 'tramp)
;; git
(require 'git)
(require 'git-blame)
;; latex
(setq TeX-PDF-mode t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
;; m-tab is already reserved for flyspell
(add-hook 'LaTeX-mode-hook
(lambda()
(local-set-key [C-tab] 'TeX-complete-symbol)))
;:; awesome from https://github.com/bendikro/emacs-conf/blob/master/setup/setup-latexmk.el
;:; Sets this as the default pdf view command
(defun setup-qpdfview()
;;(setq TeX-view-program-list '(("qpdfview" "qpdfview --instance emacsauxtex --unique \"\"%o\"#src:%(buffer-name):%n:0\"")))
(setq TeX-view-program-list '(("qpdfview" "qpdfview --instance emacsauxtex --unique \"\"%o\"#src:%(default-dir)%(buffer-name):%n:0\"")))
(setq TeX-view-program-selection '((output-pdf "qpdfview")))
)
(add-hook 'LaTeX-mode-hook 'setup-qpdfview)
;; load color-theme-sanityinc-tomorrow
(require 'color-theme-sanityinc-tomorrow)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (sanityinc-tomorrow-night)))
'(custom-safe-themes
(quote
("06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" default)))
'(footnote-section-tag "")
'(safe-local-variable-values
(quote
((eval when
(and
(buffer-file-name)
(string-match-p "\\.h\\'"
(buffer-file-name))
(not
(string-match-p "/gnulib/"
(buffer-file-name))))
(c++-mode)
(c-set-style "gnu"))))))
|