3 ;; Author: Olivier Tetard <olivier.tetard@miskin.fr>
4 ;; URL : http://toutoune25.miskin.fr/
6 ;; This file is free software; you can redistribute it and/or modify it
7 ;; under the terms of the GNU General Public License as published by the
8 ;; Free Software Foundation; either version 2, or (at your option) any
11 ;; This file is distributed in the hope that it will be useful, but
12 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;; General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU Emacs; see the file COPYING. If not, write to the Free
18 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 ;; ,----[ *** Copyright et sources *** ]
22 ;; | Ecrit par Olivier Tétard
24 ;; | Il s'agit surtout d'un piochage dans differents .gnus
27 ;; | o http://etudiant.epita.fr/~eole/emacs.html#gnus
28 ;; | o http://gnusfr.apinc.org/
29 ;; | o http://mouarf.org/config/gnus/gnus
30 ;; | o http://my.gnus.org
31 ;; | o http://www.linux-france.org/article/appli/cfg/index.html
32 ;; | o http://www.teaser.fr/~nchuche/gnus/index.html
43 ;; (require 'epa-mail)
45 (require 'spam-report)
53 (setq gnus-agent-directory "~/.gnus.d/agent")
54 (setq gnus-article-save-directory "~/.gnus.d/archives")
55 (setq gnus-cache-active-file "~/.gnus.d/news/active")
56 (setq gnus-cache-directory "~/.gnus.d/cache")
57 (setq gnus-default-directory "~")
58 (setq gnus-directory "~/.gnus.d/news")
59 (setq nntp-marks-directory "~/.gnus.d/news/marks")
60 (setq gnus-home-directory "~/.gnus.d")
61 (setq gnus-kill-files-directory "~/.gnus.d/score")
62 (setq message-directory "~/.gnus.d/mail")
63 (setq spam-directory "~/.gnus.d/spam/")
67 ;; | Parametres Personnels + Backends
71 ;; Utilisation d'identités mutliples
72 (gnus-personality-init)
74 (setq gnus-personalities
76 "Olivier Tétard <olivier.tetard@miskin.fr>"
78 "~/.gnus.d/signature")
81 "Attac Rennes <rennes@attac.org>"
83 "~/.gnus.d/signature_attac"))))
85 (setq user-full-name "Olivier Tétard")
86 (setq user-mail-address "olivier.tetard@miskin.fr")
87 (setq gnus-ignored-from-addresses '("toutoune25@.*"
88 "olivier.tetard@miskin.fr"
91 ;; Configuration du SMTP / AUTH TLS
92 ;; Penser à installer le paquet starttls !!
93 (setq send-mail-function 'smtpmail-send-it
94 message-send-mail-function 'smtpmail-send-it)
95 (setq smtpmail-smtp-server "mail.miskin.fr")
96 (setq smtpmail-starttls-credentials '(("mail.miskin.fr" 25 nil nil)))
97 (setq smtpmail-auth-credentials "~/.authinfo")
98 (load-library "smtpmail")
101 (setq gnus-select-method '(nnnil))
103 (setq gnus-secondary-select-methods '((nnimap "miskin"
104 (nnimap-address "mail.miskin.fr")
106 (remove-prefix "INBOX.")
107 (nnimap-authinfo-file "~/.authinfo"))
109 (nntp "news.gmane.org")))
110 ;; (nnmaildir "localmaildir" (directory "~/.mail/helium.miskin.fr"))))
112 ;; On ne cherche pas les nouveaux newsgroups
113 (setq gnus-check-new-newsgroups nil)
115 ;; On balance tout dans nnml:local
116 (setq nnmail-split-methods
119 ;; On sauvegarde les mails dans Sent et on les marque comme lus
120 (setq gnus-message-archive-group "nnimap+miskin:Sent")
121 (setq gnus-gcc-mark-as-read t)
123 ;; Face, stolen from:
124 ;; http://www.mwolson.org/projects/emacs-config/dot_gnus.el.html
126 ;; Specify headers that I want in every message
127 (defun my-message-insert-extra-headers ()
128 (goto-char (point-min))
129 (insert "Face: " (gnus-convert-png-to-face "~/.gnus.d/fouine.png") "\n"))
131 (add-hook 'message-header-setup-hook 'my-message-insert-extra-headers)
134 ;; ,----[ *** Comportement de Gnus *** ]
135 ;; | Lancement/Fermeture de Gnus
138 ;; On ouvre automatiquement le fichier 'newsrc-dribble'
139 (setq gnus-always-read-dribble-file t)
141 ;; On lance GNUS en mode topic
142 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
144 ;; On desactive l'abonnement automatique
145 (setq gnus-default-subscribed-newsgroups nil)
147 ;; On ne verifie pas les nouveaux groupes à chaque fois
148 (setq gnus-check-new-newsgroups t)
150 ;; On marche en mode 24H
151 (custom-set-variables '(display-time-24hr-format t))
153 ;; On active le cache
154 (setq gnus-use-cache t)
156 ;; On desactive l'impression couleur
157 (setq ps-print-color-p nil)
159 ;; On veux quitter gnus proprement
160 (defun clean-exit-emacs-with-gnus ()
161 "Save and exit Gnus before exiting Emacs"
163 (if (fboundp 'gnus-group-exit)
165 (save-buffers-kill-emacs t))
167 (global-set-key [(control x) (control c)]
168 'clean-exit-emacs-with-gnus)
171 ;; ,----[ *** Comportement de Gnus *** ]
172 ;; | Lecture d'un mail (*Group* et *Summary*)
176 ;; On ne sauvegarde pas la liste des groupes tués
177 (setq gnus-save-killed-list nil)
179 ;; On affiche les groupes vides
180 (setq gnus-permanently-visible-groups ".*")
182 ;; On ne thread que sur les références (et non pas sur les sujets)
183 ;; (setq gnus-summary-thread-gathering-function
184 ;; 'gnus-gather-threads-by-references)
186 ; Scorage des groupes les plus lus
187 (add-hook 'gnus-summary-exit-hook 'gnus-summary-bubble-group)
189 ; Classer les groupes en fonction de leur hits
190 (setq gnus-group-sort-function '(gnus-group-sort-by-unread
191 gnus-group-sort-by-rank))
193 ;; Format des folders dans *Group*
194 ;; On affiche l'heure de derniere lecture de la boite
195 (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
196 (setq gnus-group-line-format
197 "%M%S%p%P%5y: %(%G%) %l %O [%2,2~(cut 6)d/%2,2~(cut 4)d à %2,2~(cut 9)dh%2,2~(cut 11)d]\n")
199 ;; On surligne la ligne courante dans *Group* et *Summary*
202 (add-hook 'gnus-group-mode-hook 'highlight-current-line-minor-mode)
203 (add-hook 'gnus-summary-mode-hook 'highlight-current-line-minor-mode)
204 (custom-set-faces '(highlight-current-line-face ((t (:background "#6699cc")))))))
206 ;; Format des messages dans *Summary*
207 ;; (setq gnus-sum-thread-tree-single-indent " ")
208 (setq gnus-summary-line-format ":%U%R %B %s %-60= | %4L | %-20,20uB | %&user-date; \n")
210 ; Quel article lire le premier lorsqu'on sélectionne le groupe
212 ; - nil : N'affiche aucun message
213 ; - best : L'article le mieux scoré
214 ; - t : Le premier article non-lu.
215 (setq gnus-auto-select-first 'nil)
217 ;; nice summary threading from http://my.gnus.org/node/view/121
220 (setq gnus-sum-thread-tree-root "● ")
221 (setq gnus-sum-thread-tree-false-root "◯ ")
222 (setq gnus-sum-thread-tree-single-indent "◎ ")
223 (setq gnus-sum-thread-tree-leaf-with-other "├─► ")
224 (setq gnus-sum-thread-tree-vertical "│")
225 (setq gnus-sum-thread-tree-single-leaf "╰─► "))
226 ;;; (setq gnus-sum-thread-tree-false-root "~ ")
227 ;;; (setq gnus-sum-thread-tree-root "\x4912f ")
228 ;;; (setq gnus-sum-thread-tree-single-indent "\x4912b ")
229 ;;; (setq gnus-sum-thread-tree-leaf-with-other "\x4903c\x49020\x490fa ")
230 ;;; (setq gnus-sum-thread-tree-vertical "\x49022")
231 ;;; (setq gnus-sum-thread-tree-single-leaf "\x490b0\x49020\x490fa "))
233 (setq gnus-sum-thread-tree-root " >"
234 gnus-sum-thread-tree-single-indent " "
235 gnus-sum-thread-tree-vertical "|"
236 gnus-sum-thread-tree-indent " "
237 gnus-sum-thread-tree-leaf-with-other "+-> "
238 gnus-sum-thread-tree-single-leaf "`-> "))
240 ;; On ne marque pas 36 fois les topics
241 (setq gnus-summary-same-subject "")
243 ;; Parametres des groupes
244 (setq gnus-parameters
245 '(("^nnimap\\+miskin:Sent.*"
246 (gnus-summary-line-format ":%U%R %B %s %-60= | %4L | %-20,20f | %&user-date; \n"))
247 ("^nnimap\\+miskin:MailingLists\\.*"
250 ("^nnimap\\+miskin:MailingLists\\.ATTAC.*"
251 (total-expire . DISABLE)
252 (auto-expire . DISABLE)
253 (expiry-wait . never))
254 ("^nnimap\\+miskin:Junk\\.*"
256 (total-expire . t))))
258 ;; Temps avant expiration
259 (setq nnmail-expiry-wait 15)
261 ;; On supprime les messages cross postés
262 (setq gnus-suppress-duplicates t)
264 ; Lorsqu'on 'kill' un thread, celui-ci est caché
265 (setq gnus-thread-hide-killed t)
267 ; Trier les threads en fonctions du score, puis par date
268 (setq gnus-thread-sort-functions
269 '(gnus-thread-sort-by-date
270 gnus-thread-sort-by-total-score))
272 ;; sauter le reste d'un article si c'est : citation + Signature
273 (setq gnus-article-skip-boring t)
275 ;; Replie les threads par défaut
276 (setq gnus-thread-hide-subtree t)
278 ;; permet de développer, respectivement réduire les threads en appuyant
279 ;; sur la touche "flèche gauche", respectivement "flèche droite"
280 ;; Sur une idée de Ingo Ruhnke <grumbel@gmx.de>
281 (defun my-gnus-summary-show-thread ()
282 "Show thread without changing cursor positon."
284 (gnus-summary-show-thread)
288 (define-key gnus-summary-mode-map [(right)] 'my-gnus-summary-show-thread)
289 (define-key gnus-summary-mode-map [(left)] 'gnus-summary-hide-thread)
292 ;; ,----[ *** Comportement de Gnus *** ]
293 ;; | Lecture d'un mail (*Article*)
297 ;; On n'affiche pas l'emetteur
298 (add-to-list 'message-syntax-checks '(sender . disabled))
300 ;; Selection des headers à afficher
301 (setq gnus-visible-headers
302 "^\\(From:\\|Subject:\\|Date:\\|Followup-To:\\|Newsgroups:\\|To:\\|Cc:\\|X-Newsreader:\\|User-Agent:\\|X-Mailer:\\|Archived-At:\\)")
304 ;; L'affichage des messages
305 (setq gnus-article-display-hook '(gnus-article-hide-headers-if-wanted
306 gnus-article-date-lapsed
307 gnus-article-hide-pgp
308 gnus-article-treat-overstrike
309 gnus-article-de-quoted-unreadable
310 gnus-article-strip-leading-blank-lines
311 gnus-article-remove-trailing-blank-lines
312 gnus-article-strip-multiple-blank-lines
313 gnus-article-highlight
314 gnus-article-highlight-signature
315 gnus-article-emphasize
316 gnus-article-fill-cited-article))
318 ;; Definition d'une signature
319 ; Provient du manuel Gnus (Node 3.16.7)
320 (setq gnus-signature-separator
321 '("^-- $" ; The standard
322 "^-- *$" ; A common mangling
324 "^________*$" ; Underscores are also popular
326 "^----- Original Message -----$"
329 ; Ne pas inclure la signature lors d'une réponse
330 (setq message-cite-function 'message-cite-original-without-signature)
332 ;; On prefere le texte au HTML/RTF
333 (eval-after-load "mm-decode"
335 (add-to-list 'mm-discouraged-alternatives "text/html")
336 (add-to-list 'mm-discouraged-alternatives "text/richtext")))
338 ;; On utilise W3M pour le rendu HTML
339 ;;(setq mm-inline-text-html-renderer 'mm-inline-text-html-render-with-w3m)
341 ;; On code les messages en latin-1 prioritairement
342 (setq mm-coding-system-priorities
343 '(iso-latin-1 iso-latin-9 mule-utf-8))
345 ;; Rendre un message plus propre (Outlook tu pues !)
346 ;; http://my.gnus.org/node/view/94
347 (defun bhaak-wash-this-article ()
349 (gnus-article-outlook-deuglify-article)
350 (gnus-article-fill-cited-article nil '70)
351 (gnus-article-capitalize-sentences))
352 (define-key gnus-summary-mode-map "w" 'bhaak-wash-this-article)
354 ;; On active les smileys
355 (add-hook 'gnus-article-display-hook 'gnus-smiley-display t)
357 ;; On utilise Mozilla Firefox
358 (defun browse-url-firefox-new-tab (url &optional new-window)
359 "Open URL in a new tab in Firefox."
360 ;; (interactive (browse-url-interactive-arg "URL: "))
361 (let ((cmd (shell-command-to-string
362 (concat "mozilla-firefox -a firefox -remote 'openURL("
363 url ",new-tab)' > /dev/null"))))
364 (unless (string= "" cmd)
365 (message "Starting Firefox...")
366 (start-process (concat "firefox " url) nil "/bin/sh" "-c"
367 (concat "mozilla-firefox " url "|| true"))
368 (message "Starting Firefox...done"))))
370 (setq browse-url-browser-function 'browse-url-firefox-new-tab)
372 ;; On ignore les types v-card
373 (setq gnus-ignored-mime-types '("text/x-vcard"))
375 ;; la coloration des articles
376 (add-hook 'gnus-article-display-hook 'gnus-article-highlight)
379 (add-hook 'gnus-article-display-hook 'gnus-article-de-quoted-unreadable)
381 ;; cache les headers indésirables
382 (add-hook 'gnus-article-display-hook 'gnus-article-hide-headers-if-wanted)
384 ;; vire certains headers s'ils sont vides
385 (add-hook 'gnus-article-display-hook 'gnus-article-hide-boring-headers)
387 ;; vire les lignes blanches en tête
388 (add-hook 'gnus-article-display-hook 'gnus-article-strip-leading-blank-lines)
390 ;; vire les lignes blanches en queue
391 (add-hook 'gnus-article-display-hook 'gnus-article-remove-trailing-blank-lines)
393 ;; vire les lignes blanches en doubles
394 (add-hook 'gnus-article-display-hook 'gnus-article-strip-multiple-blank-lines)
396 ;; met en valeur les *machins* et autres _trucs_
397 (add-hook 'gnus-article-display-hook 'gnus-article-emphasize)
400 ;; ,----[ *** Comportement de Gnus *** ]
405 ;; Non, mais oh ! on va se laisser faire :o)
406 (setq gnus-use-scoring t)
408 ;; Suffixe employé pour les fichiers
409 (setq gnus-score-file-suffix "Score")
412 (setq gnus-summary-default-score 0)
414 ;; Ne pas afficher le message, si le score < 500
415 (setq gnus-summary-expunge-below -499)
417 ;; Méthode pour trouver le fichier Scorefile
418 (setq gnus-score-find-score-files-function 'gnus-score-find-bnews)
420 ;; Global score (http://www.xsteve.at/prg/gnus/)
421 (setq gnus-global-score-files
422 '("~/.gnus.d/score/all.Score"))
425 ;; ,----[ *** Comportement de Gnus *** ]
426 ;; | Ecriture d'un mail
431 (setq gnus-default-charset (quote iso-8859-15))
432 (setq gnus-default-posting-charset (quote iso-8859-15))
434 ;; Dans les newsgroup, repondre à l'auteur ?
435 (defadvice gnus-summary-reply (around reply-in-news activate)
437 (when (or (not (gnus-news-group-p gnus-newsgroup-name))
438 (y-or-n-p "Vraiment répondre à l'auteur ? "))
441 ;; On cite les mails avec '>'
442 (custom-set-variables '(mail-yank-prefix "> "))
444 ;; On ecrit sur 72 cols automatiquement
445 (add-hook 'message-mode-hook 'turn-on-auto-fill)
447 ;; On ne veux pas de la signature en reponse
448 (setq message-cite-function 'message-cite-original-without-signature)
450 ;; On n'utilise que Gnus => pas de .newsrc : Utile ?
451 (setq gnus-save-newsrc-file nil)
452 (setq gnus-read-newsrc-file nil)
454 ;; Dit le nom de la personne quand on cite
455 (defun message-insert-citation-line ()
456 "La fonction qui insere une ligne aux reponses"
457 (when message-reply-headers
458 (insert (mail-header-from message-reply-headers) " a tapoté :\n\n")))
460 ;; colorisation syntaxique lorsqu'on repond a un mail.
461 (add-hook 'message-mode-hook 'turn-on-font-lock)
463 ;; colorier le buffer de réponse
464 (add-hook 'gnus-message-setup-hook 'font-lock-fontify-buffer)
467 ;; Configuration des plugins
468 ;; ----------------------------------------------------------------------
471 ;; ,----[ *** BBDB *** ]
476 (bbdb-initialize 'gnus 'message)
478 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
479 (bbdb-insinuate-message)
481 ;; Ne pas utiliser la notation téléphonique US
482 (setq bbdb-north-american-phone-numbers-p nil)
484 ;; Pas de codes de localisations pour le telephone
485 (setq bbdb-default-area-code nil)
487 ;; On aide le scoring
488 (setq gnus-score-find-score-files-function
489 '(gnus-score-find-bnews bbdb/gnus-score))
492 (setq bbdb-use-pop-up nil)
494 ;; afficher les noms de bbdb plutot que celui du From:
496 (setq bbdb/gnus-summary-prefer-real-names t)
497 (setq bbdb/gnus-summary-prefer-bbdb-data t)
499 ;; permet d'empecher a bbdb de creer une nouvelle entree a chaque fois
500 ;; (setq bbdb/mail-auto-create-p t)
502 ;; on déplace le fichier bbdb
503 (setq bbdb-file "~/.gnus.d/bbdb")
505 ;; Nombre de lignes dans la popup
506 (setq bbdb-pop-up-target-lines 5)
508 ;; Sauvegarder automatiquement la base
509 (setq bbdb-offer-save nil)
511 ;; On complete sur le nom
512 (setq bbdb-completion-type 'primary-or-name)
514 ;; permet de faire défiler les différentes adresses
515 (setq bbdb-complete-name-allow-cycling t)
517 ;; La completion des alias se fait avec TAB
518 (define-key message-minibuffer-local-map (kbd "TAB") 'bbdb-complete-name)
521 ;; ,----[ *** PGG ***]
522 ;; | Configuration générale
525 (setq mml2015-use 'epg)
527 ;; Tells Gnus to inline the part
528 (eval-after-load "mm-decode"
529 '(add-to-list 'mm-inlined-types "application/pgp$"))
531 ;; Tells Gnus how to display the part when it is requested
532 (eval-after-load "mm-decode"
533 '(add-to-list 'mm-inline-media-tests '("application/pgp$"
534 mm-inline-text identity)))
536 ;; Tell Gnus not to wait for a request, just display the thing
538 (eval-after-load "mm-decode"
539 '(add-to-list 'mm-automatic-display "application/pgp$"))
541 (setq gnus-buttonized-mime-types (quote ("multipart/encrypted" "multipart/signed")))
542 (setq message-setup-hook (quote (mml-secure-message-sign)))
543 (setq mm-decrypt-option (quote known))
544 (setq mm-verify-option (quote known))
546 ;; ;; Récuperer les clés inconnues (à partir d'un serveur de clé)
547 ;; (setq pgg-query-keyserver t)
548 ;; (setq pgg-default-keyserver-address "pgp.mit.edu")
550 ;; ;; On verifie/decripte seulement pour les protocoles connus
551 ;; (setq mm-verify-option 'known)
552 ;; (setq mm-decrypt-option 'known)
554 ;; ;; On crée un bouton pour le "multipart/encrypted" (??)
555 ;; (setq gnus-buttonized-mime-types '("multipart/encrypted" "multipart/signed"))
557 ;; ;; On signe automatiquement les messages sortant
558 ;; (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
560 ;; ;; On sauvegarde le passphease 300 secs
561 ;; (setq pgg-passphrase-cache-expiry 2000)
563 ;; ;; Tells Gnus to inline the part
564 ;; (eval-after-load "mm-decode"
565 ;; '(add-to-list 'mm-inlined-types "application/pgp$"))
567 ;; ;; Tells Gnus how to display the part when it is requested
568 ;; (eval-after-load "mm-decode"
569 ;; '(add-to-list 'mm-inline-media-tests '("application/pgp$"
570 ;; mm-inline-text identity)))
572 ;; ;; Tell Gnus not to wait for a request, just display the thing
574 ;; (eval-after-load "mm-decode"
575 ;; '(add-to-list 'mm-automatic-display "application/pgp$"))
577 ;; ;; On n'affiche pas les signatures
578 ;; (eval-after-load "mm-decode"
579 ;; (quote (setq mm-automatic-display (remove "application/pgp-signature"
580 ;; mm-automatic-display))))
581 ;; ;; cache les cles PGP
582 ;; (add-hook 'gnus-article-display-hook 'gnus-article-hide-pgp)
585 ;; ,----[ *** Spam ***]
586 ;; | Configuration générale
591 ;; On utilise gmane pour rapporter les spams
592 (setq gnus-spam-process-newsgroups
593 '(("^nntp\\+news\\.gmane\\.org:"
594 ((spam spam-use-gmane)))))
596 ;; Et on copie les mails dans le dossier de spam
597 (setq gnus-spam-process-destinations
598 '(;; ("^nntp\\+news\\.gmane\\.org:" "nnimap+miskin:Junk")
599 ("^nnimap\\+miskin:*" "nnimap+miskin:Junk")))
601 ;; A trier et nouveautés
602 ;; ----------------------------------------------------------------------
605 ;; http://my.gnus.org/book/view/217
609 ;; -> http://lists.gnu.org/archive/html/info-gnus-english/2005-01/msg00198.html
610 (add-hook 'gnus-select-article-hook
611 'gnus-agent-fetch-selected-article)