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 (|
125 ("X-Spam-Flag" "YES" "Junk")
128 gnus-message-archive-group
"nnimap+gnu:INBOX"
131 (to-address .
"atreus@freelists.org")
132 (to-list .
"atreus@freelists.org"))
134 (to-address .
"deepspec@lists.cs.princeton.edu")
135 (to-list .
"deepspec@lists.cs.princeton.edu")
136 (list-identifier .
"\\[deepspec\\]"))
138 (to-address .
"emacs-devel@gnu.org")
139 (to-list .
"emacs-devel@gnu.org"))
140 ("l\\.help-gnu-emacs"
141 (to-address .
"help-gnu-emacs@gnu.org")
142 (to-list .
"help-gnu-emacs@gnu.org"))
143 ("l\\.info-gnu-emacs"
144 (to-address .
"info-gnu-emacs@gnu.org")
145 (to-list .
"info-gnu-emacs@gnu.org"))
147 (to-address .
"emacs-orgmode@gnu.org")
148 (to-list .
"emacs-orgmode@gnu.org")
149 (list-identifier .
"\\[O\\]"))
150 ("l\\.emacs-tangents"
151 (to-address .
"emacs-tangents@gnu.org")
152 (to-list .
"emacs-tangents@gnu.org"))
153 ("l\\.emacsconf-committee"
154 (to-address .
"emacsconf-committee@gnu.org")
155 (to-list .
"emacsconf-committee@gnu.org"))
156 ("l\\.emacsconf-discuss"
157 (to-address .
"emacsconf-discuss@gnu.org")
158 (to-list .
"emacsconf-discuss@gnu.org"))
159 ("l\\.emacsconf-register"
160 (to-address .
"emacsconf-register@gnu.org")
161 (to-list .
"emacsconf-register@gnu.org"))
162 ("l\\.emacsconf-submit"
163 (to-address .
"emacsconf-submit@gnu.org")
164 (to-list .
"emacsconf-submit@gnu.org"))
165 ("l\\.fencepost-users"
166 (to-address .
"fencepost-users@gnu.org")
167 (to-list .
"fencepost-users@gnu.org")
168 (list-identifier .
"\\[Fencepost-users\\]"))
170 (to-address .
"gnewsense-art@nongnu.org")
171 (to-list .
"gnewsense-art@nongnu.org")
172 (list-identifier .
"\\[gNewSense-art\\]"))
174 (to-address .
"gnewsense-dev@nongnu.org")
175 (to-list .
"gnewsense-dev@nongnu.org")
176 (list-identifier .
"\\[Gnewsense-dev\\]"))
177 ("l\\.gnewsense-users"
178 (to-address .
"gnewsense-users@nongnu.org")
179 (to-list .
"gnewsense-users@nongnu.org")
180 (list-identifier .
"\\[gNewSense-users\\]"))
181 ("l\\.gnunet-developers"
182 (to-address .
"gnunet-developers@gnu.org")
183 (to-list .
"gnunet-developers@gnu.org")
184 (list-identifier .
"\\[GNUnet-developers\\]"))
186 (to-address .
"help-gnunet@gnu.org")
187 (to-list .
"help-gnunet@gnu.org")
188 (list-identifier .
"\\[Help-gnunet\\]"))
190 (to-address .
"bug-gnuzilla@gnu.org")
191 (to-list .
"bug-gnuzilla@gnu.org")
192 (list-identifier .
"\\[Bug-gnuzilla\\]"))
194 (to-address .
"gnuzilla-dev@gnu.org")
195 (to-list .
"gnuzilla-dev@gnu.org")
196 (list-identifier .
"\\[Gnuzilla-dev\\]"))
198 (to-address .
"guile-devel@gnu.org")
199 (to-list .
"guile-devel@gnu.org"))
201 (to-address .
"guile-user@gnu.org")
202 (to-list .
"guile-user@gnu.org"))
204 (to-address .
"guix-devel@gnu.org")
205 (to-list .
"guix-devel@gnu.org"))
207 (to-address .
"help-guix@gnu.org")
208 (to-list .
"help-guix@gnu.org"))
210 (to-address .
"info-guix@gnu.org")
211 (to-list .
"info-guix@gnu.org"))
212 ("l\\.savannah-hackers-public"
213 (to-address .
"savannah-hackers-public@gnu.org")
214 (to-list .
"savannah-hackers-public@gnu.org"))
215 ("l\\.savannah-users"
216 (to-address .
"savannah-users@gnu.org")
217 (to-list .
"savannah-users@gnu.org"))
219 (to-address .
"www-commits@gnu.org")
220 (to-list .
"www-commits@gnu.org"))
222 (to-address .
"www-discuss@gnu.org")
223 (to-list .
"www-discuss@gnu.org"))
225 (to-address .
"haskell-art@we.lurk.org")
226 (to-list .
"haskell-art@we.lurk.org")
227 (list-identifier .
"\\[haskell-art\\]"))
229 (to-address .
"haskell-cafe@haskell.org")
230 (to-list .
"haskell-cafe@haskell.org")
231 (list-identifier .
"\\[Haskell-cafe\\]"))
233 (to-address .
"notmuch@notmuchmail.org")
234 (to-list .
"notmuch@notmuchmail.org"))
236 (to-address .
"dev@lists.parabola.nu")
237 (to-list .
"dev@lists.parabola.nu")
238 (list-identifier .
"\\[Dev\\]"))
239 ("l\\.~bandali\\.public-inbox"
240 (to-address .
"~bandali/public-inbox@lists.sr.ht")
241 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
242 ("l\\.~sircmpwn\\.free-writers-club"
243 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
244 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
245 ("l\\.~sircmpwn\\.srht-admins"
246 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
247 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
248 ("l\\.~sircmpwn\\.srht-announce"
249 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
250 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
251 ("l\\.~sircmpwn\\.srht-dev"
252 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
253 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
254 ("l\\.~sircmpwn\\.srht-discuss"
255 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
256 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
258 (to-address .
"webmasters@gnu.org")
259 (to-list .
"webmasters@gnu.org"))
264 ("nnimap\\+uwaterloo:.*"
266 gnus-large-newsgroup
50
267 gnus-home-directory
(b/var
"gnus/")
268 gnus-directory
(concat gnus-home-directory
"news/")
269 message-directory
(concat gnus-home-directory
"mail/")
270 nndraft-directory
(concat gnus-home-directory
"drafts/")
271 gnus-save-newsrc-file nil
272 gnus-read-newsrc-file nil
273 gnus-interactive-exit nil
274 gnus-gcc-mark-as-read t
)
276 (when (version< emacs-version
"27")
277 (with-eval-after-load 'nnmail
279 'nnmail-split-abbrev-alist
280 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
283 ;; (require 'gnus-registry)
284 ;; (setq gnus-registry-max-entries 2500)
285 ;; (setq gnus-registry-ignored-groups
286 ;; (append gnus-registry-ignored-groups
287 ;; '(("^nnimap:gnu\\.l" t)
288 ;; ("webmasters$" t))))
289 ;; (gnus-registry-initialize)
291 (with-eval-after-load 'recentf
292 (add-to-list 'recentf-exclude gnus-home-directory
)))
294 (use-package gnus-art
297 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
298 gnus-sorted-header-list
'("^From:"
318 "^X-detected-operating-system:"
325 gnus-visible-headers
(mapconcat 'identity
326 gnus-sorted-header-list
328 ;; local-lapsed article dates
329 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
330 gnus-article-date-headers
'(user-defined)
331 gnus-article-time-format
333 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
334 (local (article-make-date-line date
'local
))
335 (combined-lapsed (article-make-date-line date
338 (string-match " (.+" combined-lapsed
)
339 (match-string 0 combined-lapsed
))))
340 (concat local lapsed
))))
342 :map gnus-article-mode-map
343 ("M-L" . org-store-link
)))
345 (use-package gnus-sum
346 :bind
(:map gnus-summary-mode-map
347 :prefix-map b
/gnus-summary-prefix-map
349 ("r" . gnus-summary-reply
)
350 ("w" . gnus-summary-wide-reply
)
351 ("v" . gnus-summary-show-raw-article
))
354 :map gnus-summary-mode-map
355 ("M-L" . org-store-link
))
356 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
)
358 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
359 gnus-thread-sort-by-subject
360 gnus-thread-sort-by-date
)))
362 (use-package gnus-msg
364 (defvar b
/shemshak-signature
"Amin Bandali
365 https://shemshak.org/~bandali")
366 (defvar b
/uwaterloo-signature
"Amin Bandali, MMath
367 Cheriton School of Computer Science
368 University of Waterloo
370 (defvar b
/csc-signature
"Amin Bandali | https://bndl.org
371 System Administrator, Systems Committee
372 Computer Science Club, University of Waterloo")
373 (setq gnus-message-replysign t
376 (address "bandali@gnu.org"))
377 ("nnimap\\+gnu:l\\..*"
380 (organization "GNU"))
381 ((header "subject" "ThankCRM")
382 (to "webmasters-comment@gnu.org")
384 (eval (setq b
/message-cite-say-hi nil
)))
385 ("nnimap\\+shemshak:.*"
386 (address "amin@shemshak.org")
388 (signature b
/shemshak-signature
)
389 (gcc "nnimap+shemshak:Sent")
390 (eval (setq b
/message-cite-say-hi t
)))
391 ("nnimap\\+uwaterloo:.*"
392 (address "bandali@uwaterloo.ca")
394 (signature b
/uwaterloo-signature
))
395 ("nnimap\\+uwaterloo:INBOX"
396 (gcc "\"nnimap+uwaterloo:Sent Items\""))
398 (address "bandali@csclub.uwaterloo.ca")
399 (signature b
/csc-signature
)
400 (gcc "nnimap+csc:Sent"))))
401 :hook
(gnus-message-setup .
(lambda ()
402 (unless (mml-secure-is-encrypted-p)
403 (mml-secure-message-sign)))))
405 (use-package gnus-topic
406 :hook
(gnus-group-mode . gnus-topic-mode
)
407 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
409 (use-package gnus-agent
411 (setq gnus-agent-synchronize-flags
'ask
)
412 :hook
(gnus-group-mode . gnus-agent-mode
))
414 (use-package gnus-group
416 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
419 ;; problematic with ebdb's popup, *EBDB-Gnus*
420 (use-package gnus-win
422 (setq gnus-use-full-window nil
)))
424 (use-package gnus-dired
425 :commands gnus-dired-mode
427 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
430 (use-package gnus-utils
432 (gnus-completing-read-function 'gnus-ido-completing-read
)))
434 (use-package mm-decode
436 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
437 mm-decrypt-option
'known
438 mm-verify-option
'known
))
442 (when (version< "27" emacs-version
)
443 (set-face-attribute 'mm-uu-extract nil
:extend t
))
445 (mm-uu-diff-groups-regexp
446 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
452 (mml-secure-openpgp-encrypt-to-self t
)
453 (mml-secure-openpgp-sign-with-sender t
))
455 (use-package gnus-article-treat-patch
460 ;; note: be sure to customize faces with `:foreground "white"' when
461 ;; using a theme with a white/light background :)
462 (setq ft
/gnus-article-patch-conditions
463 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
465 (provide 'bandali-gnus
)
466 ;;; bandali-gnus.el ends here