Update elpa url, adjust rainbow-delimiters hook
[emacs.git] / .emacs.d / config / gnus.org
1 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
2 #+TITLE: gnus.org - Ganneffs gnus configuration
3 #+DATE: %Y-%m-%d
4 #+SETUPFILE: ~/.emacs.d/elisp/org-templates/level-0.org
5
6 * Preface
7 :PROPERTIES:
8 :ID: d7915b79-2c7b-4613-bfeb-552ded0580c0
9 :END:
10 Whatever. My gnus config.
11 * Functions
12
13 * Settings
14 #+BEGIN_SRC emacs-lisp
15 (setq gnus-init-file "~/.gnus")
16 (require 'gnus-load)
17 #+END_SRC
18
19
20 * Interface
21 ** Language/i18n stuff
22 In this day and age, we should be able to do utf8. Though whenever
23 possible we should use the smallest encoding able to represent our
24 stuff.
25
26 #+BEGIN_SRC emacs-lisp
27 (setq mm-coding-system-priorities '(iso-latin-1 iso-latin-9 utf-8))
28 (unify-8859-on-encoding-mode 1)
29 (unify-8859-on-decoding-mode 1)
30 (prefer-coding-system 'latin-9)
31 (prefer-coding-system 'latin-1)
32 (prefer-coding-system 'utf-8)
33 #+END_SRC
34
35 ** Display/Look&Feel/"Design" stuff
36 *** Topic
37 Topic mode lets me sort Groups into topics.
38 #+BEGIN_SRC emacs-lisp
39 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
40 #+END_SRC
41
42 And we want a slightly different look too.
43 #+BEGIN_SRC emacs-lisp
44 (setq gnus-topic-line-format "%i[ %u&topic-line; ] %v\n")
45 #+END_SRC
46 *** Summary
47 How to display summary lines
48 #+BEGIN_SRC emacs-lisp
49 (setq gnus-summary-line-format "%U%R%z (%4k) %uy%* %B%(%[ %-22,22f %]%) %s\n")
50 #+END_SRC
51
52 Use a fuzzy algorithm when comparing subjects while building up thread
53 display.
54 #+BEGIN_SRC emacs-lisp
55 (setq gnus-summary-gather-subject-limit 'fuzzy)
56 #+END_SRC
57
58 Hilighting the full line of our position in the summary buffer
59 #+BEGIN_SRC emacs-lisp
60 (require 'highline)
61 (add-hook 'gnus-summary-mode-hook 'highline-mode)
62 #+END_SRC
63
64 When a article (a mail) gets a score below this value, it is expunged
65 without me needing to do anything. Or the need to see it.
66 #+BEGIN_SRC emacs-lisp
67 (setq gnus-summary-expunge-below -1000)
68 #+END_SRC
69
70 I can mark mail and move them to a spam/ham folder, from which my
71 various spamassassins get trained later.
72 #+BEGIN_SRC emacs-lisp
73 (add-hook 'gnus-summary-mode-hook
74 (lambda ()
75 (local-set-key [C-f1] (quote jj-move-mail-spambox))))
76
77 (add-hook 'gnus-summary-mode-hook
78 (lambda ()
79 (local-set-key [C-f2] (quote jj-copy-mail-hambox))))
80 #+END_SRC
81
82 **** Spam forward to some anti-spambot
83 I know the following can be done with much nicer code, but meh.
84 #+BEGIN_SRC emacs-lisp
85 (add-hook 'gnus-summary-mode-hook
86 (lambda ()
87 (local-set-key (kbd "<f7> d") (quote jj-forward-ham-lists-debconf))))
88
89 (add-hook 'gnus-summary-mode-hook
90 (lambda ()
91 (local-set-key (kbd "<f8> d") (quote jj-forward-spam-lists-debconf))))
92
93 (add-hook 'gnus-summary-mode-hook
94 (lambda ()
95 (local-set-key (kbd "<f7> o") (quote jj-forward-ham-lists-oftc))))
96
97 (add-hook 'gnus-summary-mode-hook
98 (lambda ()
99 (local-set-key (kbd "<f8> o") (quote jj-forward-spam-lists-oftc))))
100
101 (add-hook 'gnus-summary-mode-hook
102 (lambda ()
103 (local-set-key (kbd "<f7> s") (quote jj-forward-ham-lists-spi))))
104
105 (add-hook 'gnus-summary-mode-hook
106 (lambda ()
107 (local-set-key (kbd "<f8> s") (quote jj-forward-spam-lists-spi))))
108 #+END_SRC
109
110
111 *** Group lines
112 I redefine the group-line-format to include a date when I last visited a
113 group.
114 #+BEGIN_SRC emacs-lisp
115 (setq gnus-group-line-format
116 "%M%S%p%P %4y/%4i/%6t: %(%-45,45G%3O%)%l <%2,2~(cut 6)d.%2,2~(cut 4)d.%2,2~(cut 2)d>\n")
117 #+END_SRC
118
119 To have the data needed for the /%d/ format modifier we need to help it
120 along and actually store this timestamp.
121 #+BEGIN_SRC emacs-lisp
122 (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
123 #+END_SRC
124
125 ** Keyboard changes without a better place to go to
126 *** Miscellaneous
127
128 * Mail config
129 A part of this is done in my host specific config file, as the ways of
130 accessing mail differ based on the host I am using.
131
132 ** General
133 - How do I want to connect to ssl and shell based imap servers.
134 #+BEGIN_SRC emacs-lisp
135 (setq imap-ssl-program "openssl s_client -tls1 -connect %s:%p")
136 (setq imap-shell-program "MAIL=maildir:$HOME/Maildir /usr/lib/dovecot/imap")
137 #+END_SRC
138
139 - Nowadays I am not really reading news - so I point it at a nondefined
140 place.
141 #+BEGIN_SRC emacs-lisp
142 (setq gnus-select-method (list 'nnspool (system-name)))
143 #+END_SRC
144
145 #+BEGIN_SRC emacs-lisp
146 (require 'org-gnus )
147
148 (setq nnir-mail-backend (nth 1 gnus-secondary-select-methods))
149 #+END_SRC
150
151 * Encryption/Signature related
152 #+BEGIN_SRC emacs-lisp
153 (require 'mml-sec)
154 (setq mm-verify-option 'always)
155 ;; Keine extra Signatur erzeugen.
156 (mml-signencrypt-style "pgpmime" 'combined)
157 (add-hook 'gnus-message-setup-hook 'sign-or-crypt)
158 #+END_SRC
159
160
161 * Extra packages
162 The following packages add features I want to use with gnus. And while a
163 number of them might be usable without gnus (think bbdb), I usually do
164 not use them outside, so they are here. Otherwise, they would appear in
165 [[file:emacs.org][emacs.org]]…
166
167 ** bbdb
168 Load it.
169 #+BEGIN_SRC emacs-lisp
170 (require 'bbdb)
171 (require 'bbdb-hooks)
172 (require 'bbdb-gnus)
173 (require 'bbdb-com)
174 (require 'bbdb-autoloads)
175 #+END_SRC
176
177 And ensure it is active when we need it.
178 #+BEGIN_SRC emacs-lisp
179 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
180 (add-hook 'message-setup-hook 'bbdb-define-all-aliases)
181 #+END_SRC
182
183 #+BEGIN_SRC emacs-lisp
184 (setq bbdb-complete-name-allow-cycling t)
185 (setq bbdb-hashtable-size 104729)
186 #+END_SRC
187
188 #+BEGIN_SRC emacs-lisp
189 (setq bbdb-notice-hook 'bbdb-auto-notes-hook)
190 (setq bbdb-pop-up-target-lines 6)
191 (setq bbdb-use-pop-up t)
192 (setq bbdb-file-coding-system 'utf-8)
193 (setq bbdb-default-area-code 661)
194 (setq bbdb-dial-local-prefix "0")
195 (setq bbdb-canonicalize-redundant-nets-p t)
196 (setq bbdb-notice-auto-save-file t)
197 (setq bbdb-north-american-phone-numbers-p nil)
198 (setq bbdb-offer-save t)
199 (setq bbdb-always-add-addresses t)
200 (setq bbdb-new-nets-always-primary t)
201 (setq bbdb-complete-name-allow-cycling t)
202 (setq bbdb-user-mail-names "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\)")
203 (setq bbdb-ignore-most-messages-alist '(("To" . "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\)")))
204 (setq bbdb/news-auto-create-p 'bbdb-ignore-most-messages-hook)
205 (setq bbdb/gnus-summary-known-poster-mark "+")
206 (setq bbdb/gnus-summary-mark-known-posters t)
207 (setq bbdb/gnus-summary-prefer-real-names t)
208 #+END_SRC
209
210 #+BEGIN_SRC emacs-lisp
211 (setq bbdb-auto-notes-alist
212 '(("user-agent" (".*" interface 0))
213 ("Organization" (".*" company 0))
214 ("x-mailer" (".*" interface 0))
215 ("x-newsreader" (".*" interface 0))
216 ("X-URL" (".*" url 0))
217 ("newsgroups" ("\\\\([^,]*\\\\),?" posted-to "\\\\1" t))
218 ("xref" ("\\\\b[^ ]+:[0-9]+.*" seen-in 0))))
219 (put 'seen-in 'field-separator "; ")
220 (put 'interface 'field-seperator "; ")
221 #+END_SRC
222
223 The following ensures that our bbdb entries have timestamps.
224 #+BEGIN_SRC emacs-lisp
225 (add-hook 'bbdb-create-hook 'bbdb-creation-date-hook)
226 (add-hook 'bbdb-change-hook 'bbdb-timestamp-hook)
227 #+END_SRC
228
229 ** message-utils, message-x
230 #+BEGIN_SRC emacs-lisp
231 (autoload 'message-mark-inserted-region "message-utils" nil t)
232 (autoload 'message-mark-insert-file "message-utils" nil t)
233 (autoload 'message-strip-subject-was "message-utils" nil t)
234 (autoload 'message-change-subject "message-utils" nil t)
235 (autoload 'message-xpost-fup2 "message-utils" nil t)
236 (autoload 'message-add-archive-header "message-utils" nil t)
237 (autoload 'message-reduce-to-to-cc "message-utils" nil t)
238 (define-key message-mode-map '[(control c) m] 'message-mark-inserted-region)
239 (define-key message-mode-map '[(control c) f] 'message-mark-insert-file)
240 (define-key message-mode-map '[(control c) x] 'message-xpost-fup2)
241 (define-key message-mode-map '[(control c) s] 'message-change-subject)
242 (define-key message-mode-map '[(control c) a] 'message-add-archive-header)
243 (define-key message-mode-map '[(control c) t] 'message-reduce-to-to-cc)
244 (add-hook 'message-header-setup-hook 'message-strip-subject-was)
245 (add-hook 'message-setup-hook 'message-utils-setup)
246 #+END_SRC
247
248 #+BEGIN_SRC emacs-lisp
249 (require 'message-x)
250 (setq message-x-body-function '(lambda () (interactive) (hippie-expand nil)))
251 #+END_SRC
252 ** footnote :FIXME:
253 This might be entirely replac(ed|able) by org-modes footnote handling.
254 #+BEGIN_SRC emacs-lisp
255 (require 'footnote)
256 (setq footnote-body-tag-spacing 1
257 footnote-spaced-footnotes nil
258 footnote-style 'numeric-latin
259 footnote-section-tag "Fussnoten: ")
260 (add-hook 'message-mode-hook 'footnote-mode)
261 #+END_SRC
262
263 ** smiley
264 #+BEGIN_SRC emacs-lisp
265 (require 'smiley)
266 (setq gnus-treat-display-smileys t)
267 (setq smiley-flesh-color "Yellow")
268 #+END_SRC
269 ** org-mode
270 #+BEGIN_SRC emacs-lisp
271 (add-hook 'message-mode-hook 'orgstruct++-mode 'append)
272 (add-hook 'message-mode-hook 'orgtbl-mode 'append)
273 ;(require 'org-mime)
274 ;(add-hook 'message-mode-hook
275 ; '(lambda () (local-set-key (kbd "C-c M-o") 'org-mime-htmlize))
276 ; 'append)
277 #+END_SRC
278
279 ** random-sig
280 #+BEGIN_SRC emacs-lisp
281 (require 'randomsig)
282 (define-key message-mode-map (kbd "C-c s") 'randomsig-replace-sig)
283 (define-key message-mode-map (kbd "C-c S") 'randomsig-select-sig)
284 (require 'gnus-sum) ; probably required for `gnus-summary-save-map'
285 (define-key gnus-summary-save-map "-" 'gnus/randomsig-summary-read-sig)
286 (setq randomsig-dir "/home/joerg/sigs")
287 (setq message-signature 'randomsig-signature)
288 #+END_SRC
289
290 ** sieve
291 #+BEGIN_SRC emacs-lisp
292 (require 'sieve)
293 (setq auto-mode-alist (cons '("\\.siv\\'" . sieve-mode) auto-mode-alist))
294 (require 'gnus-sieve)
295 #+END_SRC
296
297 ** whatever
298 #+BEGIN_SRC emacs-lisp
299 (require 'gnus-BTS)
300 #+END_SRC
301 #+BEGIN_SRC emacs-lisp
302 (require 'epg-config)
303 (setq mml2015-use 'epg)
304 (setq mml2015-cache-passphrase t)
305 (setq mml2015-passphrase-cache-expiry '36000)
306 (setq mml2015-sign-with-sender t)
307 (setq gnus-message-replyencrypt t)
308 (setq gnus-message-replysign t)
309 (setq gnus-message-replysignencrypted t)
310 (setq gnus-treat-x-pgp-sig t)
311 (setq mm-verify-option 'always)
312 (setq mm-decrypt-option 'always)
313 (setq gnus-buttonized-mime-types '("multipart/alternative" "multipart/encrypted" "multipart/signed"))
314 (setq epg-debug nil)
315
316 (setq mml2015-encrypt-to-self t)
317 (setq mml2015-passphrase-cache-expiry 600)
318 (setq mml2015-signers (quote ("0xB12525C4")))
319 (setq gnus-picon-databases (quote ("/usr/lib/picon" "/usr/local/faces" "/usr/share/picons")))
320 (setq gnus-summary-muttprint-program "muttprint -x -l de -e local -2 -z 10 -c auto")
321 #+END_SRC
322