1 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
2 #+TITLE: gnus.org - Ganneffs gnus configuration
4 #+SETUPFILE: ~/.emacs.d/elisp/org-templates/level-0.org
8 :ID: d7915b79-2c7b-4613-bfeb-552ded0580c0
10 Whatever. My gnus config.
14 #+BEGIN_SRC emacs-lisp
15 (setq gnus-init-file "~/.gnus")
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
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)
35 ** Display/Look&Feel/"Design" stuff
37 Topic mode lets me sort Groups into topics.
38 #+BEGIN_SRC emacs-lisp
39 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
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")
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")
52 Use a fuzzy algorithm when comparing subjects while building up thread
54 #+BEGIN_SRC emacs-lisp
55 (setq gnus-summary-gather-subject-limit 'fuzzy)
58 Hilighting the full line of our position in the summary buffer
59 #+BEGIN_SRC emacs-lisp
61 (add-hook 'gnus-summary-mode-hook 'highline-mode)
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)
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
75 (local-set-key [C-f1] (quote jj-move-mail-spambox))))
77 (add-hook 'gnus-summary-mode-hook
79 (local-set-key [C-f2] (quote jj-copy-mail-hambox))))
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
87 (local-set-key (kbd "<f7> d") (quote jj-forward-ham-lists-debconf))))
89 (add-hook 'gnus-summary-mode-hook
91 (local-set-key (kbd "<f8> d") (quote jj-forward-spam-lists-debconf))))
93 (add-hook 'gnus-summary-mode-hook
95 (local-set-key (kbd "<f7> o") (quote jj-forward-ham-lists-oftc))))
97 (add-hook 'gnus-summary-mode-hook
99 (local-set-key (kbd "<f8> o") (quote jj-forward-spam-lists-oftc))))
101 (add-hook 'gnus-summary-mode-hook
103 (local-set-key (kbd "<f7> s") (quote jj-forward-ham-lists-spi))))
105 (add-hook 'gnus-summary-mode-hook
107 (local-set-key (kbd "<f8> s") (quote jj-forward-spam-lists-spi))))
112 I redefine the group-line-format to include a date when I last visited a
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")
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)
125 ** Keyboard changes without a better place to go to
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.
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")
139 - Nowadays I am not really reading news - so I point it at a nondefined
141 #+BEGIN_SRC emacs-lisp
142 (setq gnus-select-method (list 'nnspool (system-name)))
145 #+BEGIN_SRC emacs-lisp
148 (setq nnir-mail-backend (nth 1 gnus-secondary-select-methods))
151 * Encryption/Signature related
152 #+BEGIN_SRC emacs-lisp
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)
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]]…
169 #+BEGIN_SRC emacs-lisp
171 (require 'bbdb-hooks)
174 (require 'bbdb-autoloads)
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)
183 #+BEGIN_SRC emacs-lisp
184 (setq bbdb-complete-name-allow-cycling t)
185 (setq bbdb-hashtable-size 104729)
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)
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 "; ")
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)
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)
248 #+BEGIN_SRC emacs-lisp
250 (setq message-x-body-function '(lambda () (interactive) (hippie-expand nil)))
253 This might be entirely replac(ed|able) by org-modes footnote handling.
254 #+BEGIN_SRC emacs-lisp
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)
264 #+BEGIN_SRC emacs-lisp
266 (setq gnus-treat-display-smileys t)
267 (setq smiley-flesh-color "Yellow")
270 #+BEGIN_SRC emacs-lisp
271 (add-hook 'message-mode-hook 'orgstruct++-mode 'append)
272 (add-hook 'message-mode-hook 'orgtbl-mode 'append)
274 ;(add-hook 'message-mode-hook
275 ; '(lambda () (local-set-key (kbd "C-c M-o") 'org-mime-htmlize))
280 #+BEGIN_SRC emacs-lisp
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)
291 #+BEGIN_SRC emacs-lisp
293 (setq auto-mode-alist (cons '("\\.siv\\'" . sieve-mode) auto-mode-alist))
294 (require 'gnus-sieve)
298 #+BEGIN_SRC emacs-lisp
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"))
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")