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
47 gnus-select-method
'(nnnil "")
48 gnus-secondary-select-methods
51 (nnimap-address "127.0.0.1")
52 (nnimap-server-port 143)
53 (nnimap-authenticator plain
)
54 (nnimap-user "bandali@shemshak.local"))
57 (nnimap-address "127.0.0.1")
58 (nnimap-server-port 143)
59 (nnimap-authenticator plain
)
60 (nnimap-user "bandali@gnu.local")
61 (nnimap-inbox "INBOX")
62 (nnimap-split-methods 'nnimap-split-fancy
)
63 (nnimap-split-fancy (|
64 ;; (: gnus-registry-split-fancy-with-parent)
65 ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
66 ;; keep debbugs emails in INBOX
67 (list ".*<\\(.*\\)\\.debbugs\\.gnu\\.org>.*" "INBOX")
68 ;; list moderation emails
69 (from ".+-\\(owner\\|bounces\\)@\\(non\\)?gnu\\.org" "listmod")
71 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
73 (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
75 (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
76 ;; iana (e.g. tz-announce)
77 (list ".*<\\(.*\\)\\.iana\\.org>.*" "l.\\1")
78 ;; orbitalfox (e.g. gemini)
79 (list ".*<\\(.*\\)\\.lists\\.orbitalfox\\.eu>.*" "l.\\1")
81 (list ".*<\\(.*\\)\\.haskell\\.org>.*" "l.\\1")
82 ;; *.lists.sr.ht, omitting one dot if present
83 ;; add more \\.?\\([^.]*\\) if needed
84 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists\\.sr\\.ht>.*" "l.~\\1.\\2\\3")
86 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
88 (list ".*atreus.freelists.org" "l.atreus")
89 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
90 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
91 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
92 (list ".*dev.lists.parabola.nu" "l.parabola-dev")
93 ;; ----------------------------------
94 ;; legend: (u)nsubscribed | (d)ead
95 ;; ----------------------------------
97 ("X-Spam_action" "reject" "Junk")
98 ;; otherwise, leave mail in INBOX
101 (nnimap-stream plain
)
102 (nnimap-address "127.0.0.1")
103 (nnimap-server-port 143)
104 (nnimap-authenticator plain
)
105 (nnimap-user "abandali@uwaterloo.local")
106 (nnimap-inbox "INBOX")
107 (nnimap-split-methods 'nnimap-split-fancy
)
108 (nnimap-split-fancy (|
109 ;; (: gnus-registry-split-fancy-with-parent)
111 ("subject" "SE\\s-?212" "course.se212-f19")
112 (from "SE\\s-?212" "course.se212-f19")
116 (nnimap-stream plain
)
117 (nnimap-address "127.0.0.1")
118 (nnimap-server-port 143)
119 (nnimap-authenticator plain
)
120 (nnimap-user "abandali@csclub.uwaterloo.local")
121 (nnimap-inbox "INBOX")
122 (nnimap-split-methods 'nnimap-split-fancy
)
123 (nnimap-split-fancy (|
124 ;; cron reports and other messages from root
125 (from "root@\\(.*\\.\\)?csclub\\.uwaterloo\\.ca" "INBOX")
127 ("X-Spam-Flag" "YES" "Junk")
132 (nnimap-address "mail.savoirfairelinux.com")
133 (nnimap-user "amin.bandali")))
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 ;; nnimap-record-commands t
279 gnus-large-newsgroup
50
280 gnus-home-directory
(b/var
"gnus/")
281 gnus-directory
(concat gnus-home-directory
"news/")
282 message-directory
(concat gnus-home-directory
"mail/")
283 nndraft-directory
(concat gnus-home-directory
"drafts/")
284 gnus-save-newsrc-file nil
285 gnus-read-newsrc-file nil
286 gnus-search-use-parsed-queries t
287 gnus-interactive-exit nil
288 gnus-gcc-mark-as-read t
)
290 (with-eval-after-load 'gnus
291 (when (version< emacs-version
"27")
292 (with-eval-after-load 'nnmail
294 'nnmail-split-abbrev-alist
295 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
298 ;; (require 'gnus-registry)
299 ;; (setq gnus-registry-max-entries 2500)
300 ;; (setq gnus-registry-ignored-groups
301 ;; (append gnus-registry-ignored-groups
302 ;; '(("^nnimap:gnu\\.l" t)
303 ;; ("webmasters$" t))))
304 ;; (gnus-registry-initialize)
306 (with-eval-after-load 'recentf
307 (add-to-list 'recentf-exclude gnus-home-directory
))
310 (add-hook 'gnus-group-mode-hook
#'gnus-topic-mode
)
311 (add-hook 'gnus-group-mode-hook
#'gnus-agent-mode
))
312 ;; global key bindings
313 (global-set-key (kbd "s-m") #'gnus-plugged
)
314 (global-set-key (kbd "s-M") #'gnus-unplugged
)
315 (global-set-key (kbd "C-c m") #'gnus-plugged
)
316 (global-set-key (kbd "C-c M") #'gnus-unplugged
)
318 (with-eval-after-load 'gnus-art
320 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
321 gnus-sorted-header-list
'("^From:"
341 "^X-detected-operating-system:"
348 gnus-visible-headers
(mapconcat 'identity
349 gnus-sorted-header-list
351 ;; local-lapsed article dates
352 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
353 gnus-article-date-headers
'(user-defined)
354 gnus-article-time-format
356 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
357 (local (article-make-date-line date
'local
))
358 (combined-lapsed (article-make-date-line date
361 (string-match " (.+" combined-lapsed
)
362 (match-string 0 combined-lapsed
))))
363 (concat local lapsed
))))
364 ;; local key bindings
365 (define-key gnus-article-mode-map
(kbd "M-L") #'org-store-link
))
367 (with-eval-after-load 'gnus-sum
368 (csetq gnus-thread-sort-functions
'(gnus-thread-sort-by-number
369 gnus-thread-sort-by-subject
370 gnus-thread-sort-by-date
))
371 ;; local key bindings
372 (define-key gnus-summary-mode-map
(kbd "M-L") #'org-store-link
)
373 (defvar b
/gnus-summary-prefix-map
)
374 (define-prefix-command 'b
/gnus-summary-prefix-map
)
375 (define-key gnus-summary-mode-map
(kbd "v")
376 'b
/gnus-summary-prefix-map
)
377 (define-key b
/gnus-summary-prefix-map
(kbd "r")
378 #'gnus-summary-reply
)
379 (define-key b
/gnus-summary-prefix-map
(kbd "w")
380 #'gnus-summary-wide-reply
)
381 (define-key b
/gnus-summary-prefix-map
(kbd "v")
382 #'gnus-summary-show-raw-article
))
384 (add-hook 'gnus-summary-mode-hook
#'b
/no-mouse-autoselect-window
)
387 (with-eval-after-load 'gnus-msg
388 (defvar b
/shemshak-signature
"Amin Bandali
389 https://shemshak.org/~bandali")
390 (defvar b
/uwaterloo-signature
"Amin Bandali, MMath
392 (defvar b
/csc-signature
"Amin Bandali (https://bndl.org)
393 Systems Committee <syscom@csclub.uwaterloo.ca>
394 Computer Science Club of the University of Waterloo")
395 (defvar b
/sfl-signature
"Amin Bandali
396 Free Software Consultant
400 gnus-message-replysign t
403 (address "bandali@gnu.org"))
404 ("nnimap\\+gnu:l\\..*"
407 (organization "GNU"))
408 ((header "subject" "ThankCRM")
409 (to "webmasters-comment@gnu.org")
411 (eval (setq b
/message-cite-say-hi nil
)))
412 ("nnimap\\+shemshak:.*"
413 (address "amin@shemshak.org")
415 (signature b
/shemshak-signature
)
416 (gcc "nnimap+shemshak:Sent")
417 (eval (setq b
/message-cite-say-hi t
)))
418 ("nnimap\\+uwaterloo:.*"
419 (address "bandali@uwaterloo.ca")
421 (signature b
/uwaterloo-signature
))
422 ("nnimap\\+uwaterloo:INBOX"
423 (gcc "\"nnimap+uwaterloo:Sent Items\""))
425 (address "bandali@csclub.uwaterloo.ca")
426 (signature b
/csc-signature
)
427 (gcc "nnimap+csc:Sent"))
429 (address "amin.bandali@savoirfairelinux.com")
430 (signature b
/sfl-signature
)
431 (gcc "nnimap+sfl:Sent")
432 (eval (setq-local b
/sfl-p t
))))))
434 (with-eval-after-load 'gnus
435 (add-hook 'gnus-message-setup-hook
437 (unless (or (mml-secure-is-encrypted-p)
439 (mml-secure-message-sign)))))
441 (with-eval-after-load 'gnus-topic
442 (csetq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
444 (with-eval-after-load 'gnus-agent
445 (csetq gnus-agent-synchronize-flags
'ask
))
447 (with-eval-after-load 'gnus-group
448 (csetq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
450 ;; problematic with ebdb's popup, *EBDB-Gnus*
451 ;; (with-eval-after-load 'gnus-win
452 ;; (csetq gnus-use-full-window nil))
454 (with-eval-after-load 'gnus-dired
455 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
457 ;; (with-eval-after-load 'gnus-utils
458 ;; (csetq gnus-completing-read-function 'gnus-ido-completing-read))
460 (with-eval-after-load 'mm-decode
461 (csetq mm-discouraged-alternatives
'("text/html" "text/richtext")
462 mm-decrypt-option
'known
463 mm-verify-option
'known
))
465 (with-eval-after-load 'mm-uu
466 (when (version< "27" emacs-version
)
467 (set-face-attribute 'mm-uu-extract nil
:extend t
))
468 (when (version< emacs-version
"27")
469 (csetq mm-uu-diff-groups-regexp
".")))
471 (with-eval-after-load 'mml-sec
472 (csetq mml-secure-openpgp-encrypt-to-self t
473 mml-secure-openpgp-sign-with-sender t
))
475 ;; (require 'gnus-article-treat-patch)
476 ;; ;; note: be sure to customize faces with `:foreground "white"' when
477 ;; ;; using a theme with a white/light background :)
478 ;; (setq ft/gnus-article-patch-conditions
479 ;; '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@"))
481 (provide 'bandali-gnus
)
482 ;;; bandali-gnus.el ends here