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")
74 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
76 (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
78 (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
79 ;; iana (e.g. tz-announce)
80 (list ".*<\\(.*\\)\\.iana\\.org>.*" "l.\\1")
81 ;; *.lists.sr.ht, omitting one dot if present
82 ;; add more \\.?\\([^.]*\\) if needed
83 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
85 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
87 (list ".*atreus.freelists.org" "l.atreus")
88 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
89 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
90 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
91 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
92 ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
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")
130 gnus-message-archive-group
"nnimap+gnu:INBOX"
133 (to-address .
"atreus@freelists.org")
134 (to-list .
"atreus@freelists.org"))
136 (to-address .
"deepspec@lists.cs.princeton.edu")
137 (to-list .
"deepspec@lists.cs.princeton.edu")
138 (list-identifier .
"\\[deepspec\\]"))
140 (to-address .
"emacs-devel@gnu.org")
141 (to-list .
"emacs-devel@gnu.org"))
142 ("l\\.help-gnu-emacs"
143 (to-address .
"help-gnu-emacs@gnu.org")
144 (to-list .
"help-gnu-emacs@gnu.org"))
145 ("l\\.info-gnu-emacs"
146 (to-address .
"info-gnu-emacs@gnu.org")
147 (to-list .
"info-gnu-emacs@gnu.org"))
149 (to-address .
"emacs-orgmode@gnu.org")
150 (to-list .
"emacs-orgmode@gnu.org")
151 (list-identifier .
"\\[O\\]"))
152 ("l\\.emacs-tangents"
153 (to-address .
"emacs-tangents@gnu.org")
154 (to-list .
"emacs-tangents@gnu.org"))
155 ("l\\.emacsconf-committee"
156 (to-address .
"emacsconf-committee@gnu.org")
157 (to-list .
"emacsconf-committee@gnu.org"))
158 ("l\\.emacsconf-discuss"
159 (to-address .
"emacsconf-discuss@gnu.org")
160 (to-list .
"emacsconf-discuss@gnu.org"))
161 ("l\\.emacsconf-register"
162 (to-address .
"emacsconf-register@gnu.org")
163 (to-list .
"emacsconf-register@gnu.org"))
164 ("l\\.emacsconf-submit"
165 (to-address .
"emacsconf-submit@gnu.org")
166 (to-list .
"emacsconf-submit@gnu.org"))
167 ("l\\.fencepost-users"
168 (to-address .
"fencepost-users@gnu.org")
169 (to-list .
"fencepost-users@gnu.org")
170 (list-identifier .
"\\[Fencepost-users\\]"))
172 (to-address .
"gnewsense-art@nongnu.org")
173 (to-list .
"gnewsense-art@nongnu.org")
174 (list-identifier .
"\\[gNewSense-art\\]"))
176 (to-address .
"gnewsense-dev@nongnu.org")
177 (to-list .
"gnewsense-dev@nongnu.org")
178 (list-identifier .
"\\[Gnewsense-dev\\]"))
179 ("l\\.gnewsense-users"
180 (to-address .
"gnewsense-users@nongnu.org")
181 (to-list .
"gnewsense-users@nongnu.org")
182 (list-identifier .
"\\[gNewSense-users\\]"))
183 ("l\\.gnunet-developers"
184 (to-address .
"gnunet-developers@gnu.org")
185 (to-list .
"gnunet-developers@gnu.org")
186 (list-identifier .
"\\[GNUnet-developers\\]"))
188 (to-address .
"help-gnunet@gnu.org")
189 (to-list .
"help-gnunet@gnu.org")
190 (list-identifier .
"\\[Help-gnunet\\]"))
192 (to-address .
"bug-gnuzilla@gnu.org")
193 (to-list .
"bug-gnuzilla@gnu.org")
194 (list-identifier .
"\\[Bug-gnuzilla\\]"))
196 (to-address .
"gnuzilla-dev@gnu.org")
197 (to-list .
"gnuzilla-dev@gnu.org")
198 (list-identifier .
"\\[Gnuzilla-dev\\]"))
200 (to-address .
"guile-devel@gnu.org")
201 (to-list .
"guile-devel@gnu.org"))
203 (to-address .
"guile-user@gnu.org")
204 (to-list .
"guile-user@gnu.org"))
206 (to-address .
"guix-devel@gnu.org")
207 (to-list .
"guix-devel@gnu.org"))
209 (to-address .
"help-guix@gnu.org")
210 (to-list .
"help-guix@gnu.org"))
212 (to-address .
"info-guix@gnu.org")
213 (to-list .
"info-guix@gnu.org"))
214 ("l\\.savannah-hackers-public"
215 (to-address .
"savannah-hackers-public@gnu.org")
216 (to-list .
"savannah-hackers-public@gnu.org"))
217 ("l\\.savannah-users"
218 (to-address .
"savannah-users@gnu.org")
219 (to-list .
"savannah-users@gnu.org"))
221 (to-address .
"www-commits@gnu.org")
222 (to-list .
"www-commits@gnu.org"))
224 (to-address .
"www-discuss@gnu.org")
225 (to-list .
"www-discuss@gnu.org"))
227 (to-address .
"haskell-art@we.lurk.org")
228 (to-list .
"haskell-art@we.lurk.org")
229 (list-identifier .
"\\[haskell-art\\]"))
231 (to-address .
"haskell-cafe@haskell.org")
232 (to-list .
"haskell-cafe@haskell.org")
233 (list-identifier .
"\\[Haskell-cafe\\]"))
235 (to-address .
"notmuch@notmuchmail.org")
236 (to-list .
"notmuch@notmuchmail.org"))
238 (to-address .
"dev@lists.parabola.nu")
239 (to-list .
"dev@lists.parabola.nu")
240 (list-identifier .
"\\[Dev\\]"))
241 ("l\\.~bandali\\.public-inbox"
242 (to-address .
"~bandali/public-inbox@lists.sr.ht")
243 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
244 ("l\\.~sircmpwn\\.free-writers-club"
245 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
246 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
247 ("l\\.~sircmpwn\\.srht-admins"
248 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
249 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
250 ("l\\.~sircmpwn\\.srht-announce"
251 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
252 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
253 ("l\\.~sircmpwn\\.srht-dev"
254 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
255 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
256 ("l\\.~sircmpwn\\.srht-discuss"
257 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
258 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
260 (to-address .
"webmasters@gnu.org")
261 (to-list .
"webmasters@gnu.org"))
266 ("nnimap\\+uwaterloo:.*"
268 gnus-large-newsgroup
50
269 gnus-home-directory
(b/var
"gnus/")
270 gnus-directory
(concat gnus-home-directory
"news/")
271 message-directory
(concat gnus-home-directory
"mail/")
272 nndraft-directory
(concat gnus-home-directory
"drafts/")
273 gnus-save-newsrc-file nil
274 gnus-read-newsrc-file nil
275 gnus-interactive-exit nil
276 gnus-gcc-mark-as-read t
)
278 (when (version< emacs-version
"27")
279 (with-eval-after-load 'nnmail
281 'nnmail-split-abbrev-alist
282 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
285 ;; (require 'gnus-registry)
286 ;; (setq gnus-registry-max-entries 2500)
287 ;; (setq gnus-registry-ignored-groups
288 ;; (append gnus-registry-ignored-groups
289 ;; '(("^nnimap:gnu\\.l" t)
290 ;; ("webmasters$" t))))
291 ;; (gnus-registry-initialize)
293 (with-eval-after-load 'recentf
294 (add-to-list 'recentf-exclude gnus-home-directory
)))
296 (use-package gnus-art
299 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
300 gnus-sorted-header-list
'("^From:"
320 "^X-detected-operating-system:"
327 gnus-visible-headers
(mapconcat 'identity
328 gnus-sorted-header-list
330 ;; local-lapsed article dates
331 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
332 gnus-article-date-headers
'(user-defined)
333 gnus-article-time-format
335 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
336 (local (article-make-date-line date
'local
))
337 (combined-lapsed (article-make-date-line date
340 (string-match " (.+" combined-lapsed
)
341 (match-string 0 combined-lapsed
))))
342 (concat local lapsed
))))
344 :map gnus-article-mode-map
345 ("M-L" . org-store-link
)))
347 (use-package gnus-sum
348 :bind
(:map gnus-summary-mode-map
349 :prefix-map b
/gnus-summary-prefix-map
351 ("r" . gnus-summary-reply
)
352 ("w" . gnus-summary-wide-reply
)
353 ("v" . gnus-summary-show-raw-article
))
356 :map gnus-summary-mode-map
357 ("M-L" . org-store-link
))
358 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
)
360 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
361 gnus-thread-sort-by-subject
362 gnus-thread-sort-by-date
)))
364 (use-package gnus-msg
366 (defvar b
/shemshak-signature
"Amin Bandali
367 https://shemshak.org/~bandali")
368 (defvar b
/uwaterloo-signature
"Amin Bandali, MMath
369 Cheriton School of Computer Science
370 University of Waterloo
372 (defvar b
/csc-signature
"Amin Bandali | https://bndl.org
373 System Administrator, Systems Committee
374 Computer Science Club, University of Waterloo")
375 (setq gnus-message-replysign t
378 (address "bandali@gnu.org"))
379 ("nnimap\\+gnu:l\\..*"
382 (organization "GNU"))
383 ((header "subject" "ThankCRM")
384 (to "webmasters-comment@gnu.org")
386 (eval (setq b
/message-cite-say-hi nil
)))
387 ("nnimap\\+shemshak:.*"
388 (address "amin@shemshak.org")
390 (signature b
/shemshak-signature
)
391 (gcc "nnimap+shemshak:Sent")
392 (eval (setq b
/message-cite-say-hi t
)))
393 ("nnimap\\+uwaterloo:.*"
394 (address "bandali@uwaterloo.ca")
396 (signature b
/uwaterloo-signature
))
397 ("nnimap\\+uwaterloo:INBOX"
398 (gcc "\"nnimap+uwaterloo:Sent Items\""))
400 (address "bandali@csclub.uwaterloo.ca")
401 (signature b
/csc-signature
)
402 (gcc "nnimap+csc:Sent"))))
403 :hook
(gnus-message-setup .
(lambda ()
404 (unless (mml-secure-is-encrypted-p)
405 (mml-secure-message-sign)))))
407 (use-package gnus-topic
408 :hook
(gnus-group-mode . gnus-topic-mode
)
409 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
411 (use-package gnus-agent
413 (setq gnus-agent-synchronize-flags
'ask
)
414 :hook
(gnus-group-mode . gnus-agent-mode
))
416 (use-package gnus-group
418 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
421 ;; problematic with ebdb's popup, *EBDB-Gnus*
422 (use-package gnus-win
424 (setq gnus-use-full-window nil
)))
426 (use-package gnus-dired
427 :commands gnus-dired-mode
429 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
432 (use-package gnus-utils
434 (gnus-completing-read-function 'gnus-ido-completing-read
)))
436 (use-package mm-decode
438 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
439 mm-decrypt-option
'known
440 mm-verify-option
'known
))
444 (when (version< "27" emacs-version
)
445 (set-face-attribute 'mm-uu-extract nil
:extend t
))
447 (mm-uu-diff-groups-regexp
448 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
454 (mml-secure-openpgp-encrypt-to-self t
)
455 (mml-secure-openpgp-sign-with-sender t
))
457 (use-package gnus-article-treat-patch
462 ;; note: be sure to customize faces with `:foreground "white"' when
463 ;; using a theme with a white/light background :)
464 (setq ft
/gnus-article-patch-conditions
465 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
467 (provide 'bandali-gnus
)
468 ;;; bandali-gnus.el ends here