708ed522d6df45d01d568a27a5b19ea3300b6008
[dotfiles.git] / .wl
1 ;; mode: -*-emacs-lisp-*-
2 ;
3 (setq wl-stay-folder-window t
4 wl-local-domain "gpcf.eu"
5 wl-message-id-domain "aubergine.gpcf.eu"
6 wl-from (concat user-full-name " <" user-mail-address ">")
7 ;; here starts all the maildir stuff
8 elmo-maildir-folder-path "~/Maildir"
9 wl-fcc ".sent"
10 wl-trash-folder ".trash"
11 wl-queue-folder ".queue"
12 signature-file-name "~/.signature"
13 signature-insert-at-eof t
14 signature-delete-blank-lines-at-eof t
15 wl-draft-send-mail-function 'wl-draft-send-mail-with-sendmail
16 sendmail-program (expand-file-name "~/software/mail/savemail.py")
17 default-mime-charset 'utf8
18 wl-fcc-force-as-read t
19 wl-interactive-send nil
20 wl-summary-width 120
21 )
22
23 (setq mime-edit-insert-user-agent-field nil)
24
25 (setq wl-generate-mailer-string-function
26 ; set X-Mailer string
27 (function
28 (lambda ()
29 (format "GNU Emacs Version 24.3, %s, GNU/Linux" (product-string-1 'wl-version)))))
30
31 (setq wl-demo-display-logo nil)
32 (mc-install-read-mode)
33
34
35 (defun mc-wl-verify-signature ()
36 (interactive)
37 (save-window-excursion
38 (wl-summary-jump-to-current-message)
39 (mc-verify)))
40
41 (eval-after-load "mailcrypt"
42 '(setq mc-modes-alist
43 (append
44 (quote
45 ((wl-draft-mode (encrypt . mc-encrypt-message)
46 (sign . mc-sign-message))
47 (wl-summary-mode (decrypt . mc-wl-decrypt-message)
48 (verify . mc-wl-verify-signature))))
49 mc-modes-alist)))
50 (add-hook 'wl-summary-mode-hook
51 ;; Set keybindings for
52 ;; PGP-Inline
53 '(lambda ()
54 (local-set-key "k" '(lambda ()
55 (interactive)
56 (save-window-excursion
57 (wl-summary-jump-to-current-message)
58 (gpcf-decrypt-mail))))
59 (local-set-key "0" 'mc-wl-verify-signature)
60 (local-set-key "X" '(lambda ()
61 ; checks for mail remotely using rsync.
62 (interactive)
63 (shell-command
64 (concat (expand-file-name "~/software/mail/getmail.sh") " > /dev/null 2>&1"))
65 (wl-summary-incorporate)
66 ))
67 ))
68 (defun gpcf-decrypt-mail ()
69 "Decrypts mail in MIME preview buffer. Works with both PGP/MIME
70 and PGP-Inline"
71 (interactive)
72 (save-excursion
73 (beginning-of-buffer)
74 (cond
75 ;; PGP/MIME
76 ((search-forward "<application/pgp-encrypted" nil t)
77 (let ((id "") (mess ""))
78 (save-window-excursion
79 (mime-preview-extract-current-entity)
80 (when (string-match "-[0-9]+" (buffer-name))
81 (setq id (substring (buffer-name) (match-beginning 0) (match-end 0)))
82 ))
83 (search-forward "]")
84 (save-window-excursion
85 (switch-to-buffer (concat "*Preview- *WL:Message*" id "*"))
86 (let ((temp-point (point)))
87 (end-of-buffer)
88 (setq mess (buffer-substring temp-point (point)))
89 (kill-buffer))
90 )
91 (let ((temp-point (point)) (inhibit-read-only t))
92 (search-backward "This part is encrypted" nil t)
93 (delete-region (point) temp-point)
94 (insert mess)
95 )))
96 ;;; PGP/INLINE
97 ((search-forward "-----BEGIN PGP MESSAGE-----" nil t)
98 (let ((inhibit-read-only t))
99 (mc-decrypt)))
100 (t (error "No GPG encrypted message found in this file."))))
101 )
102
103 (autoload 'sm-add-emacs-name "silly-mail" nil t)
104 (defun gpcf-setup-mail ()
105 "This function prepares the draft mode.
106 It add headers and defines keyboard shortcuts. Before the
107 message is sent, it adds the user's signature."
108 (if (string= "*draft*" (buffer-name))
109 (progn
110 (setq enc-color (face-remap-add-relative 'mode-line :background "dark red"))
111 (set-input-method "TeX")
112 (auto-fill-mode)
113 (setq default-justification 'full)
114 (sm-add-microsoft)
115 (sm-put-header "X-PGP-Key" "http://en.gpcf.eu/key.asc")
116 (local-set-key (kbd "C-c e") '(lambda ()
117 (interactive)
118 (mime-edit-set-encrypt t)
119 (mime-edit-set-sign t)
120 (message
121 "This message will be signed and encrypted")
122 (face-remap-remove-relative enc-color)
123 ))
124 (local-set-key (kbd "C-c s") 'ispell-message)
125 (local-set-key (kbd "C-c c") '(lambda ()
126 ;;; save email to queue and send it using SSH.
127 (interactive)
128 (wl-draft-send-and-exit)
129 (call-process-shell-command
130 (concat (expand-file-name "~/software/mail/sendmail.sh") "&")
131 nil 0)
132 ))
133 (delete-other-windows))
134 (mail-signature) ;; add signature
135 ))
136
137 (add-hook 'mime-edit-mode-hook 'gpcf-setup-mail)
138 ; single window mode.
139 (setq wl-stay-folder-window nil
140 wl-draft-use-frame nil
141 wl-summary-move-order 'unread
142 )
143 ;; Prevent wl from splitting large messages
144 (setq mime-edit-split-message nil)
145
146 ;; my E-Mail addresses:
147 (setq wl-user-mail-address-list '("gabriel@gpcf.eu"
148 "gpcf@gpcf.eu"))
149 (setq wl-summary-showto-folder-regexp ".*sent.*")
150
151 ;; AUTO-REFILE rules
152 (load "~/.emacs.d/files/refile-rules.el")