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")
134 gnus-message-archive-group
"nnimap+gnu:INBOX"
137 (to-address .
"atreus@freelists.org")
138 (to-list .
"atreus@freelists.org"))
140 (to-address .
"deepspec@lists.cs.princeton.edu")
141 (to-list .
"deepspec@lists.cs.princeton.edu")
142 (list-identifier .
"\\[deepspec\\]"))
144 (to-address .
"emacs-devel@gnu.org")
145 (to-list .
"emacs-devel@gnu.org"))
146 ("l\\.help-gnu-emacs"
147 (to-address .
"help-gnu-emacs@gnu.org")
148 (to-list .
"help-gnu-emacs@gnu.org"))
149 ("l\\.info-gnu-emacs"
150 (to-address .
"info-gnu-emacs@gnu.org")
151 (to-list .
"info-gnu-emacs@gnu.org"))
153 (to-address .
"emacs-orgmode@gnu.org")
154 (to-list .
"emacs-orgmode@gnu.org")
155 (list-identifier .
"\\[O\\]"))
156 ("l\\.emacs-tangents"
157 (to-address .
"emacs-tangents@gnu.org")
158 (to-list .
"emacs-tangents@gnu.org"))
159 ("l\\.emacsconf-committee"
160 (to-address .
"emacsconf-committee@gnu.org")
161 (to-list .
"emacsconf-committee@gnu.org"))
162 ("l\\.emacsconf-discuss"
163 (to-address .
"emacsconf-discuss@gnu.org")
164 (to-list .
"emacsconf-discuss@gnu.org"))
166 (to-address .
"emacsconf-org@gnu.org")
167 (to-list .
"emacsconf-org@gnu.org"))
168 ("l\\.emacsconf-org-private"
169 (to-address .
"emacsconf-org-private@gnu.org")
170 (to-list .
"emacsconf-org-private@gnu.org"))
171 ("l\\.emacsconf-register"
172 (to-address .
"emacsconf-register@gnu.org")
173 (to-list .
"emacsconf-register@gnu.org"))
174 ("l\\.emacsconf-submit"
175 (to-address .
"emacsconf-submit@gnu.org")
176 (to-list .
"emacsconf-submit@gnu.org"))
177 ("l\\.fencepost-users"
178 (to-address .
"fencepost-users@gnu.org")
179 (to-list .
"fencepost-users@gnu.org")
180 (list-identifier .
"\\[Fencepost-users\\]"))
182 (to-address .
"gnewsense-art@nongnu.org")
183 (to-list .
"gnewsense-art@nongnu.org")
184 (list-identifier .
"\\[gNewSense-art\\]"))
186 (to-address .
"gnewsense-dev@nongnu.org")
187 (to-list .
"gnewsense-dev@nongnu.org")
188 (list-identifier .
"\\[Gnewsense-dev\\]"))
189 ("l\\.gnewsense-users"
190 (to-address .
"gnewsense-users@nongnu.org")
191 (to-list .
"gnewsense-users@nongnu.org")
192 (list-identifier .
"\\[gNewSense-users\\]"))
193 ("l\\.gnunet-developers"
194 (to-address .
"gnunet-developers@gnu.org")
195 (to-list .
"gnunet-developers@gnu.org")
196 (list-identifier .
"\\[GNUnet-developers\\]"))
198 (to-address .
"help-gnunet@gnu.org")
199 (to-list .
"help-gnunet@gnu.org")
200 (list-identifier .
"\\[Help-gnunet\\]"))
202 (to-address .
"bug-gnuzilla@gnu.org")
203 (to-list .
"bug-gnuzilla@gnu.org")
204 (list-identifier .
"\\[Bug-gnuzilla\\]"))
206 (to-address .
"gnuzilla-dev@gnu.org")
207 (to-list .
"gnuzilla-dev@gnu.org")
208 (list-identifier .
"\\[Gnuzilla-dev\\]"))
210 (to-address .
"guile-devel@gnu.org")
211 (to-list .
"guile-devel@gnu.org"))
213 (to-address .
"guile-user@gnu.org")
214 (to-list .
"guile-user@gnu.org"))
216 (to-address .
"guix-devel@gnu.org")
217 (to-list .
"guix-devel@gnu.org"))
219 (to-address .
"help-guix@gnu.org")
220 (to-list .
"help-guix@gnu.org"))
222 (to-address .
"info-guix@gnu.org")
223 (to-list .
"info-guix@gnu.org"))
224 ("l\\.savannah-hackers-public"
225 (to-address .
"savannah-hackers-public@gnu.org")
226 (to-list .
"savannah-hackers-public@gnu.org"))
227 ("l\\.savannah-users"
228 (to-address .
"savannah-users@gnu.org")
229 (to-list .
"savannah-users@gnu.org"))
231 (to-address .
"www-commits@gnu.org")
232 (to-list .
"www-commits@gnu.org"))
234 (to-address .
"www-discuss@gnu.org")
235 (to-list .
"www-discuss@gnu.org"))
237 (to-address .
"haskell-art@we.lurk.org")
238 (to-list .
"haskell-art@we.lurk.org")
239 (list-identifier .
"\\[haskell-art\\]"))
241 (to-address .
"haskell-cafe@haskell.org")
242 (to-list .
"haskell-cafe@haskell.org")
243 (list-identifier .
"\\[Haskell-cafe\\]"))
245 (to-address .
"notmuch@notmuchmail.org")
246 (to-list .
"notmuch@notmuchmail.org"))
248 (to-address .
"dev@lists.parabola.nu")
249 (to-list .
"dev@lists.parabola.nu")
250 (list-identifier .
"\\[Dev\\]"))
251 ("l\\.~bandali\\.public-inbox"
252 (to-address .
"~bandali/public-inbox@lists.sr.ht")
253 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
254 ("l\\.~sircmpwn\\.free-writers-club"
255 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
256 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
257 ("l\\.~sircmpwn\\.srht-admins"
258 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
259 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
260 ("l\\.~sircmpwn\\.srht-announce"
261 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
262 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
263 ("l\\.~sircmpwn\\.srht-dev"
264 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
265 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
266 ("l\\.~sircmpwn\\.srht-discuss"
267 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
268 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
270 (to-address .
"webmasters@gnu.org")
271 (to-list .
"webmasters@gnu.org"))
276 ("nnimap\\+uwaterloo:.*"
278 gnus-large-newsgroup
50
279 gnus-home-directory
(b/var
"gnus/")
280 gnus-directory
(concat gnus-home-directory
"news/")
281 message-directory
(concat gnus-home-directory
"mail/")
282 nndraft-directory
(concat gnus-home-directory
"drafts/")
283 gnus-save-newsrc-file nil
284 gnus-read-newsrc-file nil
285 gnus-interactive-exit nil
286 gnus-gcc-mark-as-read t
)
288 (when (version< emacs-version
"27")
289 (with-eval-after-load 'nnmail
291 'nnmail-split-abbrev-alist
292 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
295 ;; (require 'gnus-registry)
296 ;; (setq gnus-registry-max-entries 2500)
297 ;; (setq gnus-registry-ignored-groups
298 ;; (append gnus-registry-ignored-groups
299 ;; '(("^nnimap:gnu\\.l" t)
300 ;; ("webmasters$" t))))
301 ;; (gnus-registry-initialize)
303 (with-eval-after-load 'recentf
304 (add-to-list 'recentf-exclude gnus-home-directory
)))
306 (use-package gnus-art
309 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
310 gnus-sorted-header-list
'("^From:"
330 "^X-detected-operating-system:"
337 gnus-visible-headers
(mapconcat 'identity
338 gnus-sorted-header-list
340 ;; local-lapsed article dates
341 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
342 gnus-article-date-headers
'(user-defined)
343 gnus-article-time-format
345 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
346 (local (article-make-date-line date
'local
))
347 (combined-lapsed (article-make-date-line date
350 (string-match " (.+" combined-lapsed
)
351 (match-string 0 combined-lapsed
))))
352 (concat local lapsed
))))
354 :map gnus-article-mode-map
355 ("M-L" . org-store-link
)))
357 (use-package gnus-sum
358 :bind
(:map gnus-summary-mode-map
359 :prefix-map b
/gnus-summary-prefix-map
361 ("r" . gnus-summary-reply
)
362 ("w" . gnus-summary-wide-reply
)
363 ("v" . gnus-summary-show-raw-article
))
366 :map gnus-summary-mode-map
367 ("M-L" . org-store-link
))
368 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
)
370 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
371 gnus-thread-sort-by-subject
372 gnus-thread-sort-by-date
)))
374 (use-package gnus-msg
376 (defvar b
/shemshak-signature
"Amin Bandali
377 https://shemshak.org/~bandali")
378 (defvar b
/uwaterloo-signature
"Amin Bandali, MMath
379 Cheriton School of Computer Science
380 University of Waterloo
382 (defvar b
/csc-signature
"Amin Bandali | https://bndl.org
383 System Administrator, Systems Committee
384 Computer Science Club, University of Waterloo")
385 (setq gnus-message-replysign t
388 (address "bandali@gnu.org"))
389 ("nnimap\\+gnu:l\\..*"
392 (organization "GNU"))
393 ((header "subject" "ThankCRM")
394 (to "webmasters-comment@gnu.org")
396 (eval (setq b
/message-cite-say-hi nil
)))
397 ("nnimap\\+shemshak:.*"
398 (address "amin@shemshak.org")
400 (signature b
/shemshak-signature
)
401 (gcc "nnimap+shemshak:Sent")
402 (eval (setq b
/message-cite-say-hi t
)))
403 ("nnimap\\+uwaterloo:.*"
404 (address "bandali@uwaterloo.ca")
406 (signature b
/uwaterloo-signature
))
407 ("nnimap\\+uwaterloo:INBOX"
408 (gcc "\"nnimap+uwaterloo:Sent Items\""))
410 (address "bandali@csclub.uwaterloo.ca")
411 (signature b
/csc-signature
)
412 (gcc "nnimap+csc:Sent"))))
413 :hook
(gnus-message-setup .
(lambda ()
414 (unless (mml-secure-is-encrypted-p)
415 (mml-secure-message-sign)))))
417 (use-package gnus-topic
418 :hook
(gnus-group-mode . gnus-topic-mode
)
419 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
421 (use-package gnus-agent
423 (setq gnus-agent-synchronize-flags
'ask
)
424 :hook
(gnus-group-mode . gnus-agent-mode
))
426 (use-package gnus-group
428 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
431 ;; problematic with ebdb's popup, *EBDB-Gnus*
432 (use-package gnus-win
434 (setq gnus-use-full-window nil
)))
436 (use-package gnus-dired
437 :commands gnus-dired-mode
439 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
442 (use-package gnus-utils
444 (gnus-completing-read-function 'gnus-ido-completing-read
)))
446 (use-package mm-decode
448 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
449 mm-decrypt-option
'known
450 mm-verify-option
'known
))
454 (when (version< "27" emacs-version
)
455 (set-face-attribute 'mm-uu-extract nil
:extend t
))
456 (when (version< emacs-version
"27")
457 (setq mm-uu-diff-groups-regexp
458 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)")))
464 (mml-secure-openpgp-encrypt-to-self t
)
465 (mml-secure-openpgp-sign-with-sender t
))
467 (use-package gnus-article-treat-patch
472 ;; note: be sure to customize faces with `:foreground "white"' when
473 ;; using a theme with a white/light background :)
474 (setq ft
/gnus-article-patch-conditions
475 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
477 (provide 'bandali-gnus
)
478 ;;; bandali-gnus.el ends here