1 ; mode: -*-emacs-lisp-*-
3 (load "silly-mail" nil t
)
4 (setq wl-stay-folder-window t
5 wl-local-domain
"gpcf.eu"
6 wl-message-id-domain
"aubergine.gpcf.eu"
7 wl-from
(concat user-full-name
" <" user-mail-address
">")
8 ;; here starts all the maildir stuff
9 elmo-maildir-folder-path
"~/Maildir"
11 wl-trash-folder
".trash"
12 wl-queue-folder
".queue"
13 signature-file-name
"~/.signature"
14 signature-insert-at-eof t
15 signature-delete-blank-lines-at-eof t
16 wl-draft-send-mail-function
'wl-draft-send-mail-with-sendmail
17 default-mime-charset
'utf8
18 wl-fcc-force-as-read t
19 wl-interactive-send nil
21 mime-pgp-decrypt-when-preview t
23 (defun wl-display-math
()
24 "Toggle display of math in buffer"
26 (let ((inhibit-read-only t
))
27 (latex-math-preview-all-formulae)))
28 (defun wl-hide-math
()
29 "Toggle display of math in buffer"
31 (let ((inhibit-read-only t
))
32 (latex-math-preview-remove-images)))
35 (add-hook 'mime-view-mode-hook
36 '(lambda () (local-set-key (kbd "ä") 'wl-next-message
)
37 (local-set-key (kbd "ö") 'wl-prev-message
)
38 (local-set-key (kbd "m") 'wl-display-math
)
39 (local-set-key (kbd "h") 'wl-hide-math
)
40 (local-set-key (kbd "d") '(lambda ()
43 (wl-summary-dispose)))
44 (local-set-key (kbd "f") '(lambda ()
47 (wl-summary-forward)))
48 (local-set-key (kbd "K") 'extract-gpg-key
)
50 (setq mime-edit-insert-user-agent-field nil
)
52 (setq wl-generate-mailer-string-function
56 (format "GNU Emacs Version 24.3, %s, GNU/Linux" (product-string-1 'wl-version
)))))
58 (setq wl-demo-display-logo nil
)
59 (mc-install-read-mode)
62 (defun mc-wl-verify-signature
()
64 (save-window-excursion
65 (wl-summary-jump-to-current-message)
68 (eval-after-load "mailcrypt"
72 ((wl-draft-mode (encrypt . mc-encrypt-message
)
73 (sign . mc-sign-message
))
74 (wl-summary-mode (decrypt . mc-wl-decrypt-message
)
75 (verify . mc-wl-verify-signature
))))
77 (defun wl-summary-click-on-message
()
78 (interactive) (wl-summary-redisplay)
79 (wl-summary-jump-to-current-message)
80 (delete-other-windows))
81 (add-hook 'wl-summary-mode-hook
82 ;; Set keybindings for
85 (local-set-key "k" '(lambda ()
87 (save-window-excursion
88 (wl-summary-jump-to-current-message)
89 (gpcf-decrypt-mail))))
90 (local-set-key "0" 'mc-wl-verify-signature
)
91 (local-set-key (kbd "ä") 'wl-next-message
)
92 (local-set-key (kbd "ö") 'wl-prev-message
)
93 (local-set-key (kbd "<return>") 'wl-summary-click-on-message
)
94 (local-set-key "X" '(lambda ()
95 ; checks for mail remotely using rsync.
98 (concat (expand-file-name "~/software/mail/getmail.sh") " > /dev/null 2>&1")) 0 )
99 (wl-summary-incorporate)
100 (error "Fetching mail failed")
102 (local-set-key (kbd "Y s") 'wl-send-to-spam-folder
)
103 (local-set-key (kbd "Y h") 'wl-send-to-ham-folder
)
105 (defun gpcf-decrypt-mail
()
106 "Decrypts mail in MIME preview buffer. Works with both PGP/MIME
107 and PGP-Inline. OBSOLETE FOR PGP/MIME, USE (setq mime-pgp-decrypt-when-preview t) instead."
110 (beginning-of-buffer)
113 ((search-forward "<application/pgp-encrypted" nil t
)
114 (let ((id "") (mess ""))
115 (save-window-excursion
116 (mime-preview-extract-current-entity)
117 (when (string-match "-[0-9]+" (buffer-name))
118 (setq id
(substring (buffer-name) (match-beginning 0) (match-end 0)))
121 (save-window-excursion
122 (switch-to-buffer (concat "*Preview- *WL:Message*" id
"*"))
123 (let ((temp-point (point)))
125 (setq mess
(buffer-substring temp-point
(point)))
128 (let ((temp-point (point)) (inhibit-read-only t
))
129 (search-backward "This part is encrypted" nil t
)
130 (delete-region (point) temp-point
)
134 ((search-forward "-----BEGIN PGP MESSAGE-----" nil t
)
135 (let ((inhibit-read-only t
))
137 (t (error "No GPG encrypted message found in this file."))))
141 (defun gpcf-setup-mail
()
142 "This function prepares the draft mode.
143 It add headers and defines keyboard shortcuts. Before the
144 message is sent, it adds the user's signature."
145 (if (string-match-p "\\*draft\\*.*" (buffer-name))
147 (setq enc-color
(face-remap-add-relative 'mode-line
:background
"dark red"))
148 ; (set-input-method "TeX")
150 (setq default-justification
'full
)
153 (sm-put-header "X-PGP-Key" "http://en.gpcf.eu/key.asc")
154 (local-set-key (kbd "C-c e") 'mime-edit-set-sign-and-encrypt
)
155 (local-set-key (kbd "C-c s") 'ispell-message
)
156 (local-set-key (kbd "C-c m s") 'wl-display-math
)
157 (local-set-key (kbd "C-c m h") 'wl-hide-math
)
158 (local-set-key (kbd "C-c c") '(lambda ()
159 ;;; save email to queue and send it using SSH.
161 (check-encryption-capabilities)
162 (wl-draft-send-and-exit)
163 (call-process-shell-command
164 (concat (expand-file-name "~/software/mail/sendmail.sh") "&")
167 (delete-other-windows))
168 (mail-signature) ;; add signature
170 (defun mime-edit-set-sign-and-encrypt
()
172 (mime-edit-set-encrypt t
)
173 (mime-edit-set-sign t
)
175 "This message will be signed and encrypted")
176 (face-remap-remove-relative enc-color
)
178 (defun check-encryption-capabilities
()
179 "Checks if the recipient can receive encrypted e-mail, based on whether they have sent you encrypted e-mail before or not"
182 (beginning-of-buffer)
183 (unless (search-forward-regexp "^To: .* <\\(.*\\)>$" nil t
)
184 (unless (search-forward-regexp "^To: \\(.*\\)$" nil t
)
185 (error "No To: address specified"))
187 (when (and (not (memq 'encrypt mime-edit-pgp-processing
))
189 ;; this person sent you encrypted email
190 (concat "mu find flag:encrypted from:" (match-string 1) " > /dev/null 2>&1")) 0 )
192 (when (yes-or-no-p "Do you want to encrypt and sign this message? ")
193 (mime-edit-set-sign-and-encrypt)
196 (add-hook 'mime-edit-mode-hook
'gpcf-setup-mail
)
197 ; single window mode.
198 (setq wl-stay-folder-window nil
199 wl-draft-use-frame nil
200 wl-summary-move-order
'new
202 ;; Prevent wl from splitting large messages
203 (setq mime-edit-split-message nil
)
205 ;; my E-Mail addresses:
206 (setq wl-user-mail-address-list
'("gabriel@gpcf.eu"
208 (setq wl-summary-showto-folder-regexp
".*sent.*")
211 (load "~/.emacs.d/files/refile-rules.el")
212 (defadvice mime-preview-quit
(after mime-preview-quit activate
)
213 (delete-other-windows)
215 (defun wl-delete-other-windows
()
216 ; (wl-summary-jump-to-current-message)
217 (delete-other-windows)
219 (defadvice wl-summary-next
(after wl-summary-next activate
)
220 ;; Prevent message window from appearing when you mark a message
221 (wl-delete-other-windows)
223 (defadvice wl-summary-prev
(after wl-summary-prev activate
)
224 (wl-delete-other-windows)
226 ;; (defadvice wl-summary-incorporate (after wl-summary-incorporate activate)
227 ;; (call-process-shell-command "mu index >/dev/null 2>/dev/null" nil 0)
229 (defun wl-next-message
()
230 "Jump to next message and open it"
232 (unless (string= (buffer-name) "Summary")
235 (wl-summary-click-on-message))
237 (defun wl-prev-message
()
238 "Jump to previous message and open it"
240 (unless (string= (buffer-name) "Summary")
243 (wl-summary-click-on-message))
245 ;; Changes: removed newline
246 (defun wl-default-draft-cite
()
247 (let ((mail-yank-ignored-headers "[^:]+:")
248 (mail-yank-prefix "> ")
249 date from cite-title
)
251 (if (< (mark t
) (point))
252 (exchange-point-and-mark))
253 (narrow-to-region (point)(point-max))
254 (setq date
(std11-field-body "date")
255 from
(std11-field-body "from")))
257 (insert (format "On %s, %s wrote:\n"
258 (or date
"some time ago")
259 (if wl-default-draft-cite-decorate-author
260 (funcall wl-summary-from-function
263 (mail-indent-citation)))
265 (require 'elmo-search
)
266 (elmo-search-register-engine
268 :prog
"/usr/bin/mu" ;; or wherever you've installed it
269 :args
'("find" pattern
"--fields" "l") :charset
'utf-8
)
271 (setq elmo-search-default-engine
'mu
)
272 ;; for when you type "g" in folder or summary.
273 (setq wl-default-spec
"[")
275 (load "~/.emacs.d/lisp/latex-math-preview.el")
276 (defun wl-send-to-ham-folder
()
278 (wl-summary-auto-save "~/Maildir/ham/")
280 (defun wl-send-to-spam-folder
()
282 (wl-summary-auto-save "~/Maildir/spam/")
284 (defun wl-summary-auto-save
(wl-save-dir)
285 "Save current message to disk."
288 (num (wl-summary-message-number)))
290 (setq wl-save-dir wl-temporary-file-directory
))
293 (setq filename
(concat wl-save-dir
(number-to-string num
) wl-summary-save-file-suffix
))
294 (wl-summary-set-message-buffer-or-redisplay)
295 (set-buffer (wl-message-get-original-buffer))
296 ;(while (not (file-exists-p filename))
297 ; (setq filename (concat (number-to-string (+ num 1)) wl-summary-save-file-suffix)))
298 (write-region-as-binary (point-min) (point-max) filename
))
299 (message "No message to save."))