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")
69 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
71 (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
73 (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
74 ;; iana (e.g. tz-announce)
75 (list ".*<\\(.*\\)\\.iana\\.org>.*" "l.\\1")
76 ;; orbitalfox (e.g. gemini)
77 (list ".*<\\(.*\\)\\.lists\\.orbitalfox\\.eu>.*" "l.\\1")
78 ;; *.lists.sr.ht, omitting one dot if present
79 ;; add more \\.?\\([^.]*\\) if needed
80 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists\\.sr\\.ht>.*" "l.~\\1.\\2\\3")
82 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
84 (list ".*atreus.freelists.org" "l.atreus")
85 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
86 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
87 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
88 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
89 (list ".*dev.lists.parabola.nu" "l.parabola-dev")
90 ;; ----------------------------------
91 ;; legend: (u)nsubscribed | (d)ead
92 ;; ----------------------------------
94 ("X-Spam_action" "reject" "Junk")
95 ;; otherwise, leave mail in INBOX
99 (nnimap-address "127.0.0.1")
100 (nnimap-server-port 143)
101 (nnimap-authenticator plain
)
102 (nnimap-user "abandali@uwaterloo.local")
103 (nnimap-inbox "INBOX")
104 (nnimap-split-methods 'nnimap-split-fancy
)
105 (nnimap-split-fancy (|
106 ;; (: gnus-registry-split-fancy-with-parent)
108 ("subject" "SE\\s-?212" "course.se212-f19")
109 (from "SE\\s-?212" "course.se212-f19")
113 (nnimap-stream plain
)
114 (nnimap-address "127.0.0.1")
115 (nnimap-server-port 143)
116 (nnimap-authenticator plain
)
117 (nnimap-user "abandali@csclub.uwaterloo.local")
118 (nnimap-inbox "INBOX")
119 (nnimap-split-methods 'nnimap-split-fancy
)
120 (nnimap-split-fancy (|
121 ;; cron reports and other messages from root
122 (from "root@\\(.*\\.\\)?csclub\\.uwaterloo\\.ca" "INBOX")
124 ("X-Spam-Flag" "YES" "Junk")
129 (nnimap-address "mail.savoirfairelinux.com")
130 (nnimap-user "amin.bandali")))
131 gnus-message-archive-group
"nnimap+gnu:INBOX"
134 (to-address .
"atreus@freelists.org")
135 (to-list .
"atreus@freelists.org"))
137 (to-address .
"deepspec@lists.cs.princeton.edu")
138 (to-list .
"deepspec@lists.cs.princeton.edu")
139 (list-identifier .
"\\[deepspec\\]"))
141 (to-address .
"emacs-devel@gnu.org")
142 (to-list .
"emacs-devel@gnu.org"))
143 ("l\\.help-gnu-emacs"
144 (to-address .
"help-gnu-emacs@gnu.org")
145 (to-list .
"help-gnu-emacs@gnu.org"))
146 ("l\\.info-gnu-emacs"
147 (to-address .
"info-gnu-emacs@gnu.org")
148 (to-list .
"info-gnu-emacs@gnu.org"))
150 (to-address .
"emacs-orgmode@gnu.org")
151 (to-list .
"emacs-orgmode@gnu.org")
152 (list-identifier .
"\\[O\\]"))
153 ("l\\.emacs-tangents"
154 (to-address .
"emacs-tangents@gnu.org")
155 (to-list .
"emacs-tangents@gnu.org"))
156 ("l\\.emacsconf-committee"
157 (to-address .
"emacsconf-committee@gnu.org")
158 (to-list .
"emacsconf-committee@gnu.org"))
159 ("l\\.emacsconf-discuss"
160 (to-address .
"emacsconf-discuss@gnu.org")
161 (to-list .
"emacsconf-discuss@gnu.org"))
163 (to-address .
"emacsconf-org@gnu.org")
164 (to-list .
"emacsconf-org@gnu.org"))
165 ("l\\.emacsconf-org-private"
166 (to-address .
"emacsconf-org-private@gnu.org")
167 (to-list .
"emacsconf-org-private@gnu.org"))
168 ("l\\.emacsconf-register"
169 (to-address .
"emacsconf-register@gnu.org")
170 (to-list .
"emacsconf-register@gnu.org"))
171 ("l\\.emacsconf-submit"
172 (to-address .
"emacsconf-submit@gnu.org")
173 (to-list .
"emacsconf-submit@gnu.org"))
174 ("l\\.fencepost-users"
175 (to-address .
"fencepost-users@gnu.org")
176 (to-list .
"fencepost-users@gnu.org")
177 (list-identifier .
"\\[Fencepost-users\\]"))
179 (to-address .
"gnewsense-art@nongnu.org")
180 (to-list .
"gnewsense-art@nongnu.org")
181 (list-identifier .
"\\[gNewSense-art\\]"))
183 (to-address .
"gnewsense-dev@nongnu.org")
184 (to-list .
"gnewsense-dev@nongnu.org")
185 (list-identifier .
"\\[Gnewsense-dev\\]"))
186 ("l\\.gnewsense-users"
187 (to-address .
"gnewsense-users@nongnu.org")
188 (to-list .
"gnewsense-users@nongnu.org")
189 (list-identifier .
"\\[gNewSense-users\\]"))
190 ("l\\.gnunet-developers"
191 (to-address .
"gnunet-developers@gnu.org")
192 (to-list .
"gnunet-developers@gnu.org")
193 (list-identifier .
"\\[GNUnet-developers\\]"))
195 (to-address .
"help-gnunet@gnu.org")
196 (to-list .
"help-gnunet@gnu.org")
197 (list-identifier .
"\\[Help-gnunet\\]"))
199 (to-address .
"bug-gnuzilla@gnu.org")
200 (to-list .
"bug-gnuzilla@gnu.org")
201 (list-identifier .
"\\[Bug-gnuzilla\\]"))
203 (to-address .
"gnuzilla-dev@gnu.org")
204 (to-list .
"gnuzilla-dev@gnu.org")
205 (list-identifier .
"\\[Gnuzilla-dev\\]"))
207 (to-address .
"guile-devel@gnu.org")
208 (to-list .
"guile-devel@gnu.org"))
210 (to-address .
"guile-user@gnu.org")
211 (to-list .
"guile-user@gnu.org"))
213 (to-address .
"guix-devel@gnu.org")
214 (to-list .
"guix-devel@gnu.org"))
216 (to-address .
"help-guix@gnu.org")
217 (to-list .
"help-guix@gnu.org"))
219 (to-address .
"info-guix@gnu.org")
220 (to-list .
"info-guix@gnu.org"))
221 ("l\\.savannah-hackers-public"
222 (to-address .
"savannah-hackers-public@gnu.org")
223 (to-list .
"savannah-hackers-public@gnu.org"))
224 ("l\\.savannah-users"
225 (to-address .
"savannah-users@gnu.org")
226 (to-list .
"savannah-users@gnu.org"))
228 (to-address .
"www-commits@gnu.org")
229 (to-list .
"www-commits@gnu.org"))
231 (to-address .
"www-discuss@gnu.org")
232 (to-list .
"www-discuss@gnu.org"))
234 (to-address .
"haskell-art@we.lurk.org")
235 (to-list .
"haskell-art@we.lurk.org")
236 (list-identifier .
"\\[haskell-art\\]"))
238 (to-address .
"haskell-cafe@haskell.org")
239 (to-list .
"haskell-cafe@haskell.org")
240 (list-identifier .
"\\[Haskell-cafe\\]"))
242 (to-address .
"notmuch@notmuchmail.org")
243 (to-list .
"notmuch@notmuchmail.org"))
245 (to-address .
"dev@lists.parabola.nu")
246 (to-list .
"dev@lists.parabola.nu")
247 (list-identifier .
"\\[Dev\\]"))
248 ("l\\.~bandali\\.public-inbox"
249 (to-address .
"~bandali/public-inbox@lists.sr.ht")
250 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
251 ("l\\.~sircmpwn\\.free-writers-club"
252 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
253 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
254 ("l\\.~sircmpwn\\.srht-admins"
255 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
256 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
257 ("l\\.~sircmpwn\\.srht-announce"
258 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
259 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
260 ("l\\.~sircmpwn\\.srht-dev"
261 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
262 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
263 ("l\\.~sircmpwn\\.srht-discuss"
264 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
265 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
267 (to-address .
"webmasters@gnu.org")
268 (to-list .
"webmasters@gnu.org"))
273 ("nnimap\\+uwaterloo:.*"
275 ;; nnimap-record-commands t
276 gnus-large-newsgroup
50
277 gnus-home-directory
(b/var
"gnus/")
278 gnus-directory
(concat gnus-home-directory
"news/")
279 message-directory
(concat gnus-home-directory
"mail/")
280 nndraft-directory
(concat gnus-home-directory
"drafts/")
281 gnus-save-newsrc-file nil
282 gnus-read-newsrc-file nil
283 gnus-interactive-exit nil
284 gnus-gcc-mark-as-read t
)
286 (with-eval-after-load 'gnus
287 (when (version< emacs-version
"27")
288 (with-eval-after-load 'nnmail
290 'nnmail-split-abbrev-alist
291 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
294 ;; (require 'gnus-registry)
295 ;; (setq gnus-registry-max-entries 2500)
296 ;; (setq gnus-registry-ignored-groups
297 ;; (append gnus-registry-ignored-groups
298 ;; '(("^nnimap:gnu\\.l" t)
299 ;; ("webmasters$" t))))
300 ;; (gnus-registry-initialize)
302 (with-eval-after-load 'recentf
303 (add-to-list 'recentf-exclude gnus-home-directory
))
306 (add-hook 'gnus-group-mode-hook
#'gnus-topic-mode
)
307 (add-hook 'gnus-group-mode-hook
#'gnus-agent-mode
))
308 ;; global key bindings
309 (global-set-key (kbd "s-m") #'gnus-plugged
)
310 (global-set-key (kbd "s-M") #'gnus-unplugged
)
311 (global-set-key (kbd "C-c a m") #'gnus-plugged
)
312 (global-set-key (kbd "C-c a M") #'gnus-unplugged
)
314 (with-eval-after-load 'gnus-art
316 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
317 gnus-sorted-header-list
'("^From:"
337 "^X-detected-operating-system:"
344 gnus-visible-headers
(mapconcat 'identity
345 gnus-sorted-header-list
347 ;; local-lapsed article dates
348 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
349 gnus-article-date-headers
'(user-defined)
350 gnus-article-time-format
352 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
353 (local (article-make-date-line date
'local
))
354 (combined-lapsed (article-make-date-line date
357 (string-match " (.+" combined-lapsed
)
358 (match-string 0 combined-lapsed
))))
359 (concat local lapsed
))))
360 ;; local key bindings
361 (define-key gnus-article-mode-map
(kbd "M-L") #'org-store-link
))
363 (with-eval-after-load 'gnus-sum
364 (csetq gnus-thread-sort-functions
'(gnus-thread-sort-by-number
365 gnus-thread-sort-by-subject
366 gnus-thread-sort-by-date
))
367 ;; local key bindings
368 (define-key gnus-summary-mode-map
(kbd "M-L") #'org-store-link
)
369 (defvar b
/gnus-summary-prefix-map
)
370 (define-prefix-command 'b
/gnus-summary-prefix-map
)
371 (define-key gnus-summary-mode-map
(kbd "v")
372 'b
/gnus-summary-prefix-map
)
373 (define-key b
/gnus-summary-prefix-map
(kbd "r")
374 #'gnus-summary-reply
)
375 (define-key b
/gnus-summary-prefix-map
(kbd "w")
376 #'gnus-summary-wide-reply
)
377 (define-key b
/gnus-summary-prefix-map
(kbd "v")
378 #'gnus-summary-show-raw-article
))
380 (add-hook 'gnus-summary-mode-hook
#'b
/no-mouse-autoselect-window
)
383 (with-eval-after-load 'gnus-msg
384 (defvar b
/shemshak-signature
"Amin Bandali
385 https://shemshak.org/~bandali")
386 (defvar b
/uwaterloo-signature
"Amin Bandali, MMath
388 (defvar b
/csc-signature
"Amin Bandali (https://bndl.org)
389 Systems Committee <syscom@csclub.uwaterloo.ca>
390 Computer Science Club of the University of Waterloo")
391 (defvar b
/sfl-signature
"Amin Bandali
392 Free Software Consultant
396 gnus-message-replysign t
399 (address "bandali@gnu.org"))
400 ("nnimap\\+gnu:l\\..*"
403 (organization "GNU"))
404 ((header "subject" "ThankCRM")
405 (to "webmasters-comment@gnu.org")
407 (eval (setq b
/message-cite-say-hi nil
)))
408 ("nnimap\\+shemshak:.*"
409 (address "amin@shemshak.org")
411 (signature b
/shemshak-signature
)
412 (gcc "nnimap+shemshak:Sent")
413 (eval (setq b
/message-cite-say-hi t
)))
414 ("nnimap\\+uwaterloo:.*"
415 (address "bandali@uwaterloo.ca")
417 (signature b
/uwaterloo-signature
))
418 ("nnimap\\+uwaterloo:INBOX"
419 (gcc "\"nnimap+uwaterloo:Sent Items\""))
421 (address "bandali@csclub.uwaterloo.ca")
422 (signature b
/csc-signature
)
423 (gcc "nnimap+csc:Sent"))
425 (address "amin.bandali@savoirfairelinux.com")
426 (signature b
/sfl-signature
)
427 (gcc "nnimap+sfl:Sent")
428 (eval (setq-local b
/sfl-p t
))))))
430 (with-eval-after-load 'gnus
431 (add-hook 'gnus-message-setup-hook
433 (unless (or (mml-secure-is-encrypted-p)
435 (mml-secure-message-sign)))))
437 (with-eval-after-load 'gnus-topic
438 (csetq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
440 (with-eval-after-load 'gnus-agent
441 (csetq gnus-agent-synchronize-flags
'ask
))
443 (with-eval-after-load 'gnus-group
444 (csetq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
447 ;; problematic with ebdb's popup, *EBDB-Gnus*
448 (with-eval-after-load 'gnus-win
449 (csetq gnus-use-full-window nil
)))
451 (with-eval-after-load 'gnus-dired
452 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
455 (with-eval-after-load 'gnus-utils
456 (csetq gnus-completing-read-function
'gnus-ido-completing-read
)))
458 (with-eval-after-load 'mm-decode
459 (csetq mm-discouraged-alternatives
'("text/html" "text/richtext")
460 mm-decrypt-option
'known
461 mm-verify-option
'known
))
463 (with-eval-after-load 'mm-uu
464 (when (version< "27" emacs-version
)
465 (set-face-attribute 'mm-uu-extract nil
:extend t
))
466 (when (version< emacs-version
"27")
467 (csetq mm-uu-diff-groups-regexp
".")))
469 (with-eval-after-load 'mml-sec
470 (csetq mml-secure-openpgp-encrypt-to-self t
471 mml-secure-openpgp-sign-with-sender t
))
473 ;; (require 'gnus-article-treat-patch)
474 ;; ;; note: be sure to customize faces with `:foreground "white"' when
475 ;; ;; using a theme with a white/light background :)
476 ;; (setq ft/gnus-article-patch-conditions
477 ;; '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@"))
479 (provide 'bandali-gnus
)
480 ;;; bandali-gnus.el ends here