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 "amin@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 ;; *.lists.sr.ht, omitting one dot if present
80 ;; add more \\.?\\([^.]*\\) if needed
81 (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
83 (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
85 (list ".*atreus.freelists.org" "l.atreus")
86 (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
87 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
88 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
89 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
90 ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
91 ;; ----------------------------------
92 ;; legend: (u)nsubscribed | (d)ead
93 ;; ----------------------------------
95 ("X-Spam-Flag" "YES" "Junk")
96 ;; otherwise, leave mail in INBOX
100 (nnimap-address "127.0.0.1")
101 (nnimap-server-port 143)
102 (nnimap-authenticator plain
)
103 (nnimap-user "abandali@uw.local")
104 (nnimap-inbox "INBOX")
105 (nnimap-split-methods 'nnimap-split-fancy
)
106 (nnimap-split-fancy (|
107 ;; (: gnus-registry-split-fancy-with-parent)
109 ("subject" "SE\\s-?212" "course.se212-f19")
110 (from "SE\\s-?212" "course.se212-f19")
114 (nnimap-stream plain
)
115 (nnimap-address "127.0.0.1")
116 (nnimap-server-port 143)
117 (nnimap-authenticator plain
)
118 (nnimap-user "abandali@csc.uw.local")))
119 gnus-message-archive-group
"nnimap+gnu:INBOX"
122 (to-address .
"atreus@freelists.org")
123 (to-list .
"atreus@freelists.org"))
125 (to-address .
"deepspec@lists.cs.princeton.edu")
126 (to-list .
"deepspec@lists.cs.princeton.edu")
127 (list-identifier .
"\\[deepspec\\]"))
129 (to-address .
"emacs-devel@gnu.org")
130 (to-list .
"emacs-devel@gnu.org"))
131 ("l\\.help-gnu-emacs"
132 (to-address .
"help-gnu-emacs@gnu.org")
133 (to-list .
"help-gnu-emacs@gnu.org"))
134 ("l\\.info-gnu-emacs"
135 (to-address .
"info-gnu-emacs@gnu.org")
136 (to-list .
"info-gnu-emacs@gnu.org"))
138 (to-address .
"emacs-orgmode@gnu.org")
139 (to-list .
"emacs-orgmode@gnu.org")
140 (list-identifier .
"\\[O\\]"))
141 ("l\\.emacs-tangents"
142 (to-address .
"emacs-tangents@gnu.org")
143 (to-list .
"emacs-tangents@gnu.org"))
144 ("l\\.emacsconf-committee"
145 (to-address .
"emacsconf-committee@gnu.org")
146 (to-list .
"emacsconf-committee@gnu.org"))
147 ("l\\.emacsconf-discuss"
148 (to-address .
"emacsconf-discuss@gnu.org")
149 (to-list .
"emacsconf-discuss@gnu.org"))
150 ("l\\.emacsconf-register"
151 (to-address .
"emacsconf-register@gnu.org")
152 (to-list .
"emacsconf-register@gnu.org"))
153 ("l\\.emacsconf-submit"
154 (to-address .
"emacsconf-submit@gnu.org")
155 (to-list .
"emacsconf-submit@gnu.org"))
156 ("l\\.fencepost-users"
157 (to-address .
"fencepost-users@gnu.org")
158 (to-list .
"fencepost-users@gnu.org")
159 (list-identifier .
"\\[Fencepost-users\\]"))
161 (to-address .
"gnewsense-art@nongnu.org")
162 (to-list .
"gnewsense-art@nongnu.org")
163 (list-identifier .
"\\[gNewSense-art\\]"))
165 (to-address .
"gnewsense-dev@nongnu.org")
166 (to-list .
"gnewsense-dev@nongnu.org")
167 (list-identifier .
"\\[Gnewsense-dev\\]"))
168 ("l\\.gnewsense-users"
169 (to-address .
"gnewsense-users@nongnu.org")
170 (to-list .
"gnewsense-users@nongnu.org")
171 (list-identifier .
"\\[gNewSense-users\\]"))
172 ("l\\.gnunet-developers"
173 (to-address .
"gnunet-developers@gnu.org")
174 (to-list .
"gnunet-developers@gnu.org")
175 (list-identifier .
"\\[GNUnet-developers\\]"))
177 (to-address .
"help-gnunet@gnu.org")
178 (to-list .
"help-gnunet@gnu.org")
179 (list-identifier .
"\\[Help-gnunet\\]"))
181 (to-address .
"bug-gnuzilla@gnu.org")
182 (to-list .
"bug-gnuzilla@gnu.org")
183 (list-identifier .
"\\[Bug-gnuzilla\\]"))
185 (to-address .
"gnuzilla-dev@gnu.org")
186 (to-list .
"gnuzilla-dev@gnu.org")
187 (list-identifier .
"\\[Gnuzilla-dev\\]"))
189 (to-address .
"guile-devel@gnu.org")
190 (to-list .
"guile-devel@gnu.org"))
192 (to-address .
"guile-user@gnu.org")
193 (to-list .
"guile-user@gnu.org"))
195 (to-address .
"guix-devel@gnu.org")
196 (to-list .
"guix-devel@gnu.org"))
198 (to-address .
"help-guix@gnu.org")
199 (to-list .
"help-guix@gnu.org"))
201 (to-address .
"info-guix@gnu.org")
202 (to-list .
"info-guix@gnu.org"))
203 ("l\\.savannah-hackers-public"
204 (to-address .
"savannah-hackers-public@gnu.org")
205 (to-list .
"savannah-hackers-public@gnu.org"))
206 ("l\\.savannah-users"
207 (to-address .
"savannah-users@gnu.org")
208 (to-list .
"savannah-users@gnu.org"))
210 (to-address .
"www-commits@gnu.org")
211 (to-list .
"www-commits@gnu.org"))
213 (to-address .
"www-discuss@gnu.org")
214 (to-list .
"www-discuss@gnu.org"))
216 (to-address .
"haskell-art@we.lurk.org")
217 (to-list .
"haskell-art@we.lurk.org")
218 (list-identifier .
"\\[haskell-art\\]"))
220 (to-address .
"haskell-cafe@haskell.org")
221 (to-list .
"haskell-cafe@haskell.org")
222 (list-identifier .
"\\[Haskell-cafe\\]"))
224 (to-address .
"notmuch@notmuchmail.org")
225 (to-list .
"notmuch@notmuchmail.org"))
227 (to-address .
"dev@lists.parabola.nu")
228 (to-list .
"dev@lists.parabola.nu")
229 (list-identifier .
"\\[Dev\\]"))
230 ("l\\.~bandali\\.public-inbox"
231 (to-address .
"~bandali/public-inbox@lists.sr.ht")
232 (to-list .
"~bandali/public-inbox@lists.sr.ht"))
233 ("l\\.~sircmpwn\\.free-writers-club"
234 (to-address .
"~sircmpwn/free-writers-club@lists.sr.ht")
235 (to-list .
"~sircmpwn/free-writers-club@lists.sr.ht"))
236 ("l\\.~sircmpwn\\.srht-admins"
237 (to-address .
"~sircmpwn/sr.ht-admins@lists.sr.ht")
238 (to-list .
"~sircmpwn/sr.ht-admins@lists.sr.ht"))
239 ("l\\.~sircmpwn\\.srht-announce"
240 (to-address .
"~sircmpwn/sr.ht-announce@lists.sr.ht")
241 (to-list .
"~sircmpwn/sr.ht-announce@lists.sr.ht"))
242 ("l\\.~sircmpwn\\.srht-dev"
243 (to-address .
"~sircmpwn/sr.ht-dev@lists.sr.ht")
244 (to-list .
"~sircmpwn/sr.ht-dev@lists.sr.ht"))
245 ("l\\.~sircmpwn\\.srht-discuss"
246 (to-address .
"~sircmpwn/sr.ht-discuss@lists.sr.ht")
247 (to-list .
"~sircmpwn/sr.ht-discuss@lists.sr.ht"))
249 (to-address .
"webmasters@gnu.org")
250 (to-list .
"webmasters@gnu.org"))
257 gnus-large-newsgroup
50
258 gnus-home-directory
(b/var
"gnus/")
259 gnus-directory
(concat gnus-home-directory
"news/")
260 message-directory
(concat gnus-home-directory
"mail/")
261 nndraft-directory
(concat gnus-home-directory
"drafts/")
262 gnus-save-newsrc-file nil
263 gnus-read-newsrc-file nil
264 gnus-interactive-exit nil
265 gnus-gcc-mark-as-read t
)
267 (when (version< emacs-version
"27")
268 (with-eval-after-load 'nnmail
270 'nnmail-split-abbrev-alist
271 '(list .
"list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
274 ;; (gnus-registry-initialize)
276 (with-eval-after-load 'recentf
277 (add-to-list 'recentf-exclude gnus-home-directory
)))
279 (use-package gnus-art
282 gnus-buttonized-mime-types
'("multipart/\\(signed\\|encrypted\\)")
283 gnus-sorted-header-list
'("^From:"
303 "^X-detected-operating-system:"
310 gnus-visible-headers
(mapconcat 'identity
311 gnus-sorted-header-list
313 ;; local-lapsed article dates
314 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
315 gnus-article-date-headers
'(user-defined)
316 gnus-article-time-format
318 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time
))
319 (local (article-make-date-line date
'local
))
320 (combined-lapsed (article-make-date-line date
323 (string-match " (.+" combined-lapsed
)
324 (match-string 0 combined-lapsed
))))
325 (concat local lapsed
))))
327 :map gnus-article-mode-map
328 ("M-L" . org-store-link
)))
330 (use-package gnus-sum
331 :bind
(:map gnus-summary-mode-map
332 :prefix-map b
/gnus-summary-prefix-map
334 ("r" . gnus-summary-reply
)
335 ("w" . gnus-summary-wide-reply
)
336 ("v" . gnus-summary-show-raw-article
))
339 :map gnus-summary-mode-map
340 ("M-L" . org-store-link
))
341 :hook
(gnus-summary-mode . b
/no-mouse-autoselect-window
)
343 (gnus-thread-sort-functions '(gnus-thread-sort-by-number
344 gnus-thread-sort-by-subject
345 gnus-thread-sort-by-date
)))
347 (use-package gnus-msg
349 (defvar b
/shemshak-signature
"Amin Bandali
350 https://shemshak.org/~amin")
351 (defvar b
/uw-signature
"Amin Bandali, MMath Student
352 Cheriton School of Computer Science
353 University of Waterloo
354 https://bandali.eu.org")
355 (defvar b
/csc-signature
"Amin Bandali
356 System Administrator, Systems Committee
357 Computer Science Club, University of Waterloo
358 https://csclub.uwaterloo.ca/~abandali")
359 (setq gnus-message-replysign t
362 (address "bandali@gnu.org"))
363 ("nnimap\\+gnu:l\\..*"
366 (organization "GNU"))
367 ((header "subject" "ThankCRM")
368 (to "webmasters-comment@gnu.org")
370 (eval (setq b
/message-cite-say-hi nil
)))
371 ("nnimap\\+shemshak:.*"
372 (address "amin@shemshak.org")
374 (signature b
/shemshak-signature
)
375 (gcc "nnimap+shemshak:Sent")
376 (eval (setq b
/message-cite-say-hi t
)))
378 (address "bandali@uwaterloo.ca")
380 (signature b
/uw-signature
))
382 (gcc "\"nnimap+uw:Sent Items\""))
384 (address "bandali@csclub.uwaterloo.ca")
385 (signature b
/csc-signature
)
386 (gcc "nnimap+csc:Sent"))))
387 :hook
(gnus-message-setup .
(lambda ()
388 (unless (mml-secure-is-encrypted-p)
389 (mml-secure-message-sign)))))
391 (use-package gnus-topic
392 :hook
(gnus-group-mode . gnus-topic-mode
)
393 :config
(setq gnus-topic-line-format
"%i[ %A: %(%{%n%}%) ]%v\n"))
395 (use-package gnus-agent
397 (setq gnus-agent-synchronize-flags
'ask
)
398 :hook
(gnus-group-mode . gnus-agent-mode
))
400 (use-package gnus-group
402 (setq gnus-permanently-visible-groups
"\\(:INBOX$\\|:gnu$\\)"))
405 ;; problematic with ebdb's popup, *EBDB-Gnus*
406 (use-package gnus-win
408 (setq gnus-use-full-window nil
)))
410 (use-package gnus-dired
411 :commands gnus-dired-mode
413 (add-hook 'dired-mode-hook
'gnus-dired-mode
))
416 (use-package gnus-utils
418 (gnus-completing-read-function 'gnus-ido-completing-read
)))
420 (use-package mm-decode
422 (setq mm-discouraged-alternatives
'("text/html" "text/richtext")
423 mm-decrypt-option
'known
424 mm-verify-option
'known
))
428 (when (version< "27" emacs-version
)
429 (set-face-attribute 'mm-uu-extract nil
:extend t
))
431 (mm-uu-diff-groups-regexp
432 "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
438 (mml-secure-openpgp-encrypt-to-self t
)
439 (mml-secure-openpgp-sign-with-sender t
))
441 (use-package gnus-article-treat-patch
446 ;; note: be sure to customize faces with `:foreground "white"' when
447 ;; using a theme with a white/light background :)
448 (setq ft
/gnus-article-patch-conditions
449 '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
451 (provide 'bandali-gnus
)
452 ;;; bandali-gnus.el ends here