1 ;;; bandali-gnus.el --- bandali's Gnus setup -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2018-2020 Amin Bandali
5 ;; Author: Amin Bandali <bandali@gnu.org>
6 ;; Keywords: mail, news
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
23 ;; My trusty super awesome Gnus setup.
27 (defvar b
/maildir
(expand-file-name "~/mail/"))
28 (with-eval-after-load 'recentf
29 (add-to-list 'recentf-exclude b
/maildir
))
31 (defvar b
/gnus-init-file
(b/etc
"gnus"))
35 (defvar nndraft-directory
)
36 (defvar gnus-read-newsrc-file
)
37 (defvar gnus-save-newsrc-file
)
38 (defvar gnus-gcc-mark-as-read
)
39 (defvar nnmail-split-abbrev-alist
)))
41 (declare-function article-make-date-line
"gnus-art" (date type
))
44 mail-user-agent
'gnus-user-agent
45 read-mail-command
'gnus
)
48 :bind
(("s-m" . gnus-plugged
)
49 ("s-M" . gnus-unplugged
)
50 ("C-c a m" . gnus-plugged
)
51 ("C-c a M" . gnus-unplugged
))
54 gnus-select-method
'(nnnil "")
55 gnus-secondary-select-methods
58 (nnimap-address "127.0.0.1")
59 (nnimap-server-port 143)
60 (nnimap-authenticator plain
)
61 (nnimap-user "bandali@shemshak.local"))
64 (nnimap-address "127.0.0.1")
65 (nnimap-server-port 143)
66 (nnimap-authenticator plain
)
67 (nnimap-user "bandali@gnu.local")
68 (nnimap-inbox "INBOX")
69 (nnimap-split-methods 'nnimap-split-fancy
)
70 (nnimap-split-fancy (|
71 ;; (: gnus-registry-split-fancy-with-parent)
72 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
73 ;; keep debbugs emails in INBOX
74 (list ".*<\\(.*\\)\\.debbugs\\.gnu\\.org>.*" "INBOX")
76 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
78 (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
80 (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
81 ;; iana (e.g. tz-announce)
82 (list ".*<\\(.*\\)\\.iana\\.org>.*" "l.\\1")
83 ;; orbitalfox (e.g. gemini)
84 (list ".*<\\(.*\\)\\.lists\\.orbitalfox\\.eu>.*" "l.\\1")
85 ;; *.lists.sr.ht, omitting one dot if present
86 ;; add more \\.?\\([^.]*\\) if needed
87 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists\\.sr\\.ht>.*" "l.~\\1.\\2\\3")
89 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
91 (list ".*atreus.freelists.org" "l.atreus")
92 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
93 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
94 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
95 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
96 (list ".*dev.lists.parabola.nu" "l.parabola-dev")
97 ;; ----------------------------------
98 ;; legend: (u)nsubscribed | (d)ead
99 ;; ----------------------------------
101 ("X-Spam_action" "reject" "Junk")
102 ;; otherwise, leave mail in INBOX
105 (nnimap-stream plain
)
106 (nnimap-address "127.0.0.1")
107 (nnimap-server-port 143)
108 (nnimap-authenticator plain
)
109 (nnimap-user "abandali@uwaterloo.local")
110 (nnimap-inbox "INBOX")
111 (nnimap-split-methods 'nnimap-split-fancy
)
112 (nnimap-split-fancy (|
113 ;; (: gnus-registry-split-fancy-with-parent)
115 ("subject" "SE\\s-?212" "course.se212-f19")
116 (from "SE\\s-?212" "course.se212-f19")
120 (nnimap-stream plain
)
121 (nnimap-address "127.0.0.1")
122 (nnimap-server-port 143)
123 (nnimap-authenticator plain
)
124 (nnimap-user "abandali@csclub.uwaterloo.local")
125 (nnimap-inbox "INBOX")
126 (nnimap-split-methods 'nnimap-split-fancy
)
127 (nnimap-split-fancy (|
128 ;; cron reports and other messages from root
129 (from "root@\\(.*\\.\\)?csclub\\.uwaterloo\\.ca" "INBOX")
131 ("X-Spam-Flag" "YES" "Junk")
136 (nnimap-address "mail.savoirfairelinux.com")
137 (nnimap-user "amin.bandali")))
138 gnus-message-archive-group
"nnimap+gnu:INBOX"
141 (to-address .
"atreus@freelists.org")
142 (to-list .
"atreus@freelists.org"))
144 (to-address .
"deepspec@lists.cs.princeton.edu")
145 (to-list .
"deepspec@lists.cs.princeton.edu")
146 (list-identifier .
"\\[deepspec\\]"))
148 (to-address .
"emacs-devel@gnu.org")
149 (to-list .
"emacs-devel@gnu.org"))
150 ("l\\.help-gnu-emacs"
151 (to-address .
"help-gnu-emacs@gnu.org")
152 (to-list .
"help-gnu-emacs@gnu.org"))
153 ("l\\.info-gnu-emacs"
154 (to-address .
"info-gnu-emacs@gnu.org")
155 (to-list .
"info-gnu-emacs@gnu.org"))
157 (to-address .
"emacs-orgmode@gnu.org")
158 (to-list .
"emacs-orgmode@gnu.org")
159 (list-identifier .
"\\[O\\]"))
160 ("l\\.emacs-tangents"
161 (to-address .
"emacs-tangents@gnu.org")
162 (to-list .
"emacs-tangents@gnu.org"))
163 ("l\\.emacsconf-committee"
164 (to-address .
"emacsconf-committee@gnu.org")
165 (to-list .
"emacsconf-committee@gnu.org"))
166 ("l\\.emacsconf-discuss"
167 (to-address .
"emacsconf-discuss@gnu.org")
168 (to-list .
"emacsconf-discuss@gnu.org"))
170 (to-address .
"emacsconf-org@gnu.org")
171 (to-list .
"emacsconf-org@gnu.org"))
172 ("l\\.emacsconf-org-private"
173 (to-address .
"emacsconf-org-private@gnu.org")
174 (to-list .
"emacsconf-org-private@gnu.org"))
175 ("l\\.emacsconf-register"
176 (to-address .
"emacsconf-register@gnu.org")
177 (to-list .
"emacsconf-register@gnu.org"))
178 ("l\\.emacsconf-submit"
179 (to-address .
"emacsconf-submit@gnu.org")
180 (to-list .
"emacsconf-submit@gnu.org"))
181 ("l\\.fencepost-users"
182 (to-address .
"fencepost-users@gnu.org")
183 (to-list .
"fencepost-users@gnu.org")
184 (list-identifier .
"\\[Fencepost-users\\]"))
186 (to-address .
"gnewsense-art@nongnu.org")
187 (to-list .
"gnewsense-art@nongnu.org")
188 (list-identifier .
"\\[gNewSense-art\\]"))
190 (to-address .
"gnewsense-dev@nongnu.org")
191 (to-list .
"gnewsense-dev@nongnu.org")
192 (list-identifier .
"\\[Gnewsense-dev\\]"))
193 ("l\\.gnewsense-users"
194 (to-address .
"gnewsense-users@nongnu.org")
195 (to-list .
"gnewsense-users@nongnu.org")
196 (list-identifier .
"\\[gNewSense-users\\]"))
197 ("l\\.gnunet-developers"
198 (to-address .
"gnunet-developers@gnu.org")
199 (to-list .
"gnunet-developers@gnu.org")
200 (list-identifier .
"\\[GNUnet-developers\\]"))
202 (to-address .
"help-gnunet@gnu.org")
203 (to-list .
"help-gnunet@gnu.org")
204 (list-identifier .
"\\[Help-gnunet\\]"))
206 (to-address .
"bug-gnuzilla@gnu.org")
207 (to-list .
"bug-gnuzilla@gnu.org")
208 (list-identifier .
"\\[Bug-gnuzilla\\]"))
210 (to-address .
"gnuzilla-dev@gnu.org")
211 (to-list .
"gnuzilla-dev@gnu.org")
212 (list-identifier .
"\\[Gnuzilla-dev\\]"))
214 (to-address .
"guile-devel@gnu.org")
215 (to-list .
"guile-devel@gnu.org"))
217 (to-address .
"guile-user@gnu.org")
218 (to-list .
"guile-user@gnu.org"))
220 (to-address .
"guix-devel@gnu.org")
221 (to-list .
"guix-devel@gnu.org"))
223 (to-address .
"help-guix@gnu.org")
224 (to-list .
"help-guix@gnu.org"))
226 (to-address .
"info-guix@gnu.org")
227 (to-list .
"info-guix@gnu.org"))
228 ("l\\.savannah-hackers-public"
229 (to-address .
"savannah-hackers-public@gnu.org")
230 (to-list .
"savannah-hackers-public@gnu.org"))
231 ("l\\.savannah-users"
232 (to-address .
"savannah-users@gnu.org")
233 (to-list .
"savannah-users@gnu.org"))
235 (to-address .
"www-commits@gnu.org")
236 (to-list .
"www-commits@gnu.org"))
238 (to-address .
"www-discuss@gnu.org")
239 (to-list .
"www-discuss@gnu.org"))
241 (to-address .
"haskell-art@we.lurk.org")
242 (to-list .
"haskell-art@we.lurk.org")
243 (list-identifier .
"\\[haskell-art\\]"))
245 (to-address .
"haskell-cafe@haskell.org")
246 (to-list .
"haskell-cafe@haskell.org")
247 (list-identifier .
"\\[Haskell-cafe\\]"))
249 (to-address .
"notmuch@notmuchmail.org")
250 (to-list .
"notmuch@notmuchmail.org"))
252 (to-address .
"dev@lists.parabola.nu")
253 (to-list .
"dev@lists.parabola.nu")
254 (list-identifier .
"\\[Dev\\]"))
255 ("l\\.~bandali\\.public-inbox"
256 (to-address .
"~bandali/public-inbox@lists.sr.ht")
257 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
258 ("l\\.~sircmpwn\\.free-writers-club"
259 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
260 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
261 ("l\\.~sircmpwn\\.srht-admins"
262 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
263 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
264 ("l\\.~sircmpwn\\.srht-announce"
265 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
266 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
267 ("l\\.~sircmpwn\\.srht-dev"
268 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
269 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
270 ("l\\.~sircmpwn\\.srht-discuss"
271 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
272 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
274 (to-address .
"webmasters@gnu.org")
275 (to-list .
"webmasters@gnu.org"))
280 ("nnimap\\+uwaterloo:.*"
282 ;; nnimap-record-commands t
283 gnus-large-newsgroup
50
284 gnus-home-directory
(b/var
"gnus/")
285 gnus-directory
(concat gnus-home-directory
"news/")
286 message-directory
(concat gnus-home-directory
"mail/")
287 nndraft-directory
(concat gnus-home-directory
"drafts/")
288 gnus-save-newsrc-file nil
289 gnus-read-newsrc-file nil
290 gnus-interactive-exit nil
291 gnus-gcc-mark-as-read t
)
293 (when (version< emacs-version
"27")
294 (with-eval-after-load 'nnmail
296 'nnmail-split-abbrev-alist
297 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
300 ;; (require 'gnus-registry)
301 ;; (setq gnus-registry-max-entries 2500)
302 ;; (setq gnus-registry-ignored-groups
303 ;; (append gnus-registry-ignored-groups
304 ;; '(("^nnimap:gnu\\.l" t)
305 ;; ("webmasters$" t))))
306 ;; (gnus-registry-initialize)
308 (with-eval-after-load 'recentf
309 (add-to-list 'recentf-exclude gnus-home-directory
)))
311 (use-package gnus-art
314 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
315 gnus-sorted-header-list
'("^From:"
335 "^X-detected-operating-system:"
342 gnus-visible-headers
(mapconcat 'identity
343 gnus-sorted-header-list
345 ;; local-lapsed article dates
346 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
347 gnus-article-date-headers
'(user-defined)
348 gnus-article-time-format
350 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
351 (local (article-make-date-line date
'local
))
352 (combined-lapsed (article-make-date-line date
355 (string-match " (.+" combined-lapsed
)
356 (match-string 0 combined-lapsed
))))
357 (concat local lapsed
))))
359 :map gnus-article-mode-map
360 ("M-L" . org-store-link
)))
362 (use-package gnus-sum
363 :bind
(:map gnus-summary-mode-map
364 :prefix-map b
/gnus-summary-prefix-map
366 ("r" . gnus-summary-reply
)
367 ("w" . gnus-summary-wide-reply
)
368 ("v" . gnus-summary-show-raw-article
))
371 :map gnus-summary-mode-map
372 ("M-L" . org-store-link
))
373 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
)
375 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
376 gnus-thread-sort-by-subject
377 gnus-thread-sort-by-date
)))
379 (use-package gnus-msg
383 (defvar b
/shemshak-signature
"Amin Bandali
384 https://shemshak.org/~bandali")
385 (defvar b
/uwaterloo-signature
"Amin Bandali, MMath
387 (defvar b
/csc-signature
"Amin Bandali | https://bndl.org
388 System Administrator, Systems Committee
389 Computer Science Club, University of Waterloo")
390 (defvar b
/sfl-signature
"Amin Bandali
391 Free Software Consultant
394 (setq gnus-message-replysign t
397 (address "bandali@gnu.org"))
398 ("nnimap\\+gnu:l\\..*"
401 (organization "GNU"))
402 ((header "subject" "ThankCRM")
403 (to "webmasters-comment@gnu.org")
405 (eval (setq b
/message-cite-say-hi nil
)))
406 ("nnimap\\+shemshak:.*"
407 (address "amin@shemshak.org")
409 (signature b
/shemshak-signature
)
410 (gcc "nnimap+shemshak:Sent")
411 (eval (setq b
/message-cite-say-hi t
)))
412 ("nnimap\\+uwaterloo:.*"
413 (address "bandali@uwaterloo.ca")
415 (signature b
/uwaterloo-signature
))
416 ("nnimap\\+uwaterloo:INBOX"
417 (gcc "\"nnimap+uwaterloo:Sent Items\""))
419 (address "bandali@csclub.uwaterloo.ca")
420 (signature b
/csc-signature
)
421 (gcc "nnimap+csc:Sent"))
423 (address "amin.bandali@savoirfairelinux.com")
424 (signature b
/sfl-signature
)
425 (gcc "nnimap+sfl:Sent")
426 (eval (setq-local b
/sfl-p t
)))))
427 :hook
(gnus-message-setup .
(lambda ()
428 (unless (or (mml-secure-is-encrypted-p)
430 (mml-secure-message-sign)))))
432 (use-package gnus-topic
433 :hook
(gnus-group-mode . gnus-topic-mode
)
434 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
436 (use-package gnus-agent
438 (setq gnus-agent-synchronize-flags
'ask
)
439 :hook
(gnus-group-mode . gnus-agent-mode
))
441 (use-package gnus-group
443 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
446 ;; problematic with ebdb's popup, *EBDB-Gnus*
447 (use-package gnus-win
449 (setq gnus-use-full-window nil
)))
451 (use-package gnus-dired
452 :commands gnus-dired-mode
454 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
457 (use-package gnus-utils
459 (gnus-completing-read-function 'gnus-ido-completing-read
)))
461 (use-package mm-decode
463 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
464 mm-decrypt-option
'known
465 mm-verify-option
'known
))
469 (when (version< "27" emacs-version
)
470 (set-face-attribute 'mm-uu-extract nil
:extend t
))
471 (when (version< emacs-version
"27")
472 (setq mm-uu-diff-groups-regexp
473 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)")))
479 (mml-secure-openpgp-encrypt-to-self t
)
480 (mml-secure-openpgp-sign-with-sender t
))
482 (use-package gnus-article-treat-patch
487 ;; note: be sure to customize faces with `:foreground "white"' when
488 ;; using a theme with a white/light background :)
489 (setq ft
/gnus-article-patch-conditions
490 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
492 (provide 'bandali-gnus
)
493 ;;; bandali-gnus.el ends here