| 1 | (defvar b/maildir (expand-file-name "~/mail/")) |
| 2 | (with-eval-after-load 'recentf |
| 3 | (add-to-list 'recentf-exclude b/maildir)) |
| 4 | |
| 5 | (defvar b/gnus-init-file (b/etc "gnus")) |
| 6 | |
| 7 | (eval-when-compile |
| 8 | (progn |
| 9 | (defvar nndraft-directory) |
| 10 | (defvar gnus-read-newsrc-file) |
| 11 | (defvar gnus-save-newsrc-file) |
| 12 | (defvar gnus-gcc-mark-as-read) |
| 13 | (defvar nnmail-split-abbrev-alist))) |
| 14 | |
| 15 | (declare-function article-make-date-line "gnus-art" (date type)) |
| 16 | |
| 17 | (setq |
| 18 | mail-user-agent 'gnus-user-agent |
| 19 | read-mail-command 'gnus) |
| 20 | |
| 21 | (use-package gnus |
| 22 | :bind (("s-m" . gnus-plugged) |
| 23 | ("s-M" . gnus-unplugged) |
| 24 | ("C-c a m" . gnus-plugged) |
| 25 | ("C-c a M" . gnus-unplugged)) |
| 26 | :init |
| 27 | (setq |
| 28 | gnus-select-method '(nnnil "") |
| 29 | gnus-secondary-select-methods |
| 30 | '((nnimap "shemshak" |
| 31 | (nnimap-stream plain) |
| 32 | (nnimap-address "127.0.0.1") |
| 33 | (nnimap-server-port 143) |
| 34 | (nnimap-authenticator plain) |
| 35 | (nnimap-user "amin@shemshak.local")) |
| 36 | (nnimap "gnu" |
| 37 | (nnimap-stream plain) |
| 38 | (nnimap-address "127.0.0.1") |
| 39 | (nnimap-server-port 143) |
| 40 | (nnimap-authenticator plain) |
| 41 | (nnimap-user "bandali@gnu.local") |
| 42 | (nnimap-inbox "INBOX") |
| 43 | (nnimap-split-methods 'nnimap-split-fancy) |
| 44 | (nnimap-split-fancy (| |
| 45 | ;; (: gnus-registry-split-fancy-with-parent) |
| 46 | ;; (: gnus-group-split-fancy "INBOX" t "INBOX") |
| 47 | ;; gnu |
| 48 | (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1") |
| 49 | ;; gnus |
| 50 | (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1") |
| 51 | ;; libreplanet |
| 52 | (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1") |
| 53 | ;; *.lists.sr.ht, omitting one dot if present |
| 54 | ;; add more \\.?\\([^.]*\\) if needed |
| 55 | (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3") |
| 56 | ;; webmasters |
| 57 | (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters") |
| 58 | ;; other |
| 59 | (list ".*atreus.freelists.org" "l.atreus") |
| 60 | (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec") |
| 61 | ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d |
| 62 | (list ".*haskell-cafe.haskell.org" "l.haskell-cafe") |
| 63 | ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u |
| 64 | ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u |
| 65 | ;; ---------------------------------- |
| 66 | ;; legend: (u)nsubscribed | (d)ead |
| 67 | ;; ---------------------------------- |
| 68 | ;; otherwise, leave mail in INBOX |
| 69 | "INBOX"))) |
| 70 | (nnimap "uw" |
| 71 | (nnimap-stream plain) |
| 72 | (nnimap-address "127.0.0.1") |
| 73 | (nnimap-server-port 143) |
| 74 | (nnimap-authenticator plain) |
| 75 | (nnimap-user "abandali@uw.local") |
| 76 | (nnimap-inbox "INBOX") |
| 77 | (nnimap-split-methods 'nnimap-split-fancy) |
| 78 | (nnimap-split-fancy (| |
| 79 | ;; (: gnus-registry-split-fancy-with-parent) |
| 80 | ;; se212-f19 |
| 81 | ("subject" "SE\\s-?212" "course.se212-f19") |
| 82 | (from "SE\\s-?212" "course.se212-f19") |
| 83 | ;; catch-all |
| 84 | "INBOX"))) |
| 85 | (nnimap "csc" |
| 86 | (nnimap-stream plain) |
| 87 | (nnimap-address "127.0.0.1") |
| 88 | (nnimap-server-port 143) |
| 89 | (nnimap-authenticator plain) |
| 90 | (nnimap-user "abandali@csc.uw.local"))) |
| 91 | gnus-message-archive-group "nnimap+gnu:INBOX" |
| 92 | gnus-parameters |
| 93 | '(("l\\.atreus" |
| 94 | (to-address . "atreus@freelists.org") |
| 95 | (to-list . "atreus@freelists.org")) |
| 96 | ("l\\.deepspec" |
| 97 | (to-address . "deepspec@lists.cs.princeton.edu") |
| 98 | (to-list . "deepspec@lists.cs.princeton.edu") |
| 99 | (list-identifier . "\\[deepspec\\]")) |
| 100 | ("l\\.emacs-devel" |
| 101 | (to-address . "emacs-devel@gnu.org") |
| 102 | (to-list . "emacs-devel@gnu.org")) |
| 103 | ("l\\.help-gnu-emacs" |
| 104 | (to-address . "help-gnu-emacs@gnu.org") |
| 105 | (to-list . "help-gnu-emacs@gnu.org")) |
| 106 | ("l\\.info-gnu-emacs" |
| 107 | (to-address . "info-gnu-emacs@gnu.org") |
| 108 | (to-list . "info-gnu-emacs@gnu.org")) |
| 109 | ("l\\.emacs-orgmode" |
| 110 | (to-address . "emacs-orgmode@gnu.org") |
| 111 | (to-list . "emacs-orgmode@gnu.org") |
| 112 | (list-identifier . "\\[O\\]")) |
| 113 | ("l\\.emacs-tangents" |
| 114 | (to-address . "emacs-tangents@gnu.org") |
| 115 | (to-list . "emacs-tangents@gnu.org")) |
| 116 | ("l\\.emacsconf-committee" |
| 117 | (to-address . "emacsconf-committee@gnu.org") |
| 118 | (to-list . "emacsconf-committee@gnu.org")) |
| 119 | ("l\\.emacsconf-discuss" |
| 120 | (to-address . "emacsconf-discuss@gnu.org") |
| 121 | (to-list . "emacsconf-discuss@gnu.org")) |
| 122 | ("l\\.emacsconf-register" |
| 123 | (to-address . "emacsconf-register@gnu.org") |
| 124 | (to-list . "emacsconf-register@gnu.org")) |
| 125 | ("l\\.emacsconf-submit" |
| 126 | (to-address . "emacsconf-submit@gnu.org") |
| 127 | (to-list . "emacsconf-submit@gnu.org")) |
| 128 | ("l\\.fencepost-users" |
| 129 | (to-address . "fencepost-users@gnu.org") |
| 130 | (to-list . "fencepost-users@gnu.org") |
| 131 | (list-identifier . "\\[Fencepost-users\\]")) |
| 132 | ("l\\.gnewsense-art" |
| 133 | (to-address . "gnewsense-art@nongnu.org") |
| 134 | (to-list . "gnewsense-art@nongnu.org") |
| 135 | (list-identifier . "\\[gNewSense-art\\]")) |
| 136 | ("l\\.gnewsense-dev" |
| 137 | (to-address . "gnewsense-dev@nongnu.org") |
| 138 | (to-list . "gnewsense-dev@nongnu.org") |
| 139 | (list-identifier . "\\[Gnewsense-dev\\]")) |
| 140 | ("l\\.gnewsense-users" |
| 141 | (to-address . "gnewsense-users@nongnu.org") |
| 142 | (to-list . "gnewsense-users@nongnu.org") |
| 143 | (list-identifier . "\\[gNewSense-users\\]")) |
| 144 | ("l\\.gnunet-developers" |
| 145 | (to-address . "gnunet-developers@gnu.org") |
| 146 | (to-list . "gnunet-developers@gnu.org") |
| 147 | (list-identifier . "\\[GNUnet-developers\\]")) |
| 148 | ("l\\.help-gnunet" |
| 149 | (to-address . "help-gnunet@gnu.org") |
| 150 | (to-list . "help-gnunet@gnu.org") |
| 151 | (list-identifier . "\\[Help-gnunet\\]")) |
| 152 | ("l\\.bug-gnuzilla" |
| 153 | (to-address . "bug-gnuzilla@gnu.org") |
| 154 | (to-list . "bug-gnuzilla@gnu.org") |
| 155 | (list-identifier . "\\[Bug-gnuzilla\\]")) |
| 156 | ("l\\.gnuzilla-dev" |
| 157 | (to-address . "gnuzilla-dev@gnu.org") |
| 158 | (to-list . "gnuzilla-dev@gnu.org") |
| 159 | (list-identifier . "\\[Gnuzilla-dev\\]")) |
| 160 | ("l\\.guile-devel" |
| 161 | (to-address . "guile-devel@gnu.org") |
| 162 | (to-list . "guile-devel@gnu.org")) |
| 163 | ("l\\.guile-user" |
| 164 | (to-address . "guile-user@gnu.org") |
| 165 | (to-list . "guile-user@gnu.org")) |
| 166 | ("l\\.guix-devel" |
| 167 | (to-address . "guix-devel@gnu.org") |
| 168 | (to-list . "guix-devel@gnu.org")) |
| 169 | ("l\\.help-guix" |
| 170 | (to-address . "help-guix@gnu.org") |
| 171 | (to-list . "help-guix@gnu.org")) |
| 172 | ("l\\.info-guix" |
| 173 | (to-address . "info-guix@gnu.org") |
| 174 | (to-list . "info-guix@gnu.org")) |
| 175 | ("l\\.savannah-hackers-public" |
| 176 | (to-address . "savannah-hackers-public@gnu.org") |
| 177 | (to-list . "savannah-hackers-public@gnu.org")) |
| 178 | ("l\\.savannah-users" |
| 179 | (to-address . "savannah-users@gnu.org") |
| 180 | (to-list . "savannah-users@gnu.org")) |
| 181 | ("l\\.www-commits" |
| 182 | (to-address . "www-commits@gnu.org") |
| 183 | (to-list . "www-commits@gnu.org")) |
| 184 | ("l\\.www-discuss" |
| 185 | (to-address . "www-discuss@gnu.org") |
| 186 | (to-list . "www-discuss@gnu.org")) |
| 187 | ("l\\.haskell-art" |
| 188 | (to-address . "haskell-art@we.lurk.org") |
| 189 | (to-list . "haskell-art@we.lurk.org") |
| 190 | (list-identifier . "\\[haskell-art\\]")) |
| 191 | ("l\\.haskell-cafe" |
| 192 | (to-address . "haskell-cafe@haskell.org") |
| 193 | (to-list . "haskell-cafe@haskell.org") |
| 194 | (list-identifier . "\\[Haskell-cafe\\]")) |
| 195 | ("l\\.notmuch" |
| 196 | (to-address . "notmuch@notmuchmail.org") |
| 197 | (to-list . "notmuch@notmuchmail.org")) |
| 198 | ("l\\.parabola-dev" |
| 199 | (to-address . "dev@lists.parabola.nu") |
| 200 | (to-list . "dev@lists.parabola.nu") |
| 201 | (list-identifier . "\\[Dev\\]")) |
| 202 | ("l\\.~bandali\\.public-inbox" |
| 203 | (to-address . "~bandali/public-inbox@lists.sr.ht") |
| 204 | (to-list . "~bandali/public-inbox@lists.sr.ht")) |
| 205 | ("l\\.~sircmpwn\\.free-writers-club" |
| 206 | (to-address . "~sircmpwn/free-writers-club@lists.sr.ht") |
| 207 | (to-list . "~sircmpwn/free-writers-club@lists.sr.ht")) |
| 208 | ("l\\.~sircmpwn\\.srht-admins" |
| 209 | (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") |
| 210 | (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) |
| 211 | ("l\\.~sircmpwn\\.srht-announce" |
| 212 | (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") |
| 213 | (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) |
| 214 | ("l\\.~sircmpwn\\.srht-dev" |
| 215 | (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") |
| 216 | (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) |
| 217 | ("l\\.~sircmpwn\\.srht-discuss" |
| 218 | (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") |
| 219 | (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) |
| 220 | ("webmasters" |
| 221 | (to-address . "webmasters@gnu.org") |
| 222 | (to-list . "webmasters@gnu.org")) |
| 223 | ("gnu.*" |
| 224 | (gcc-self . t)) |
| 225 | ("l\\." |
| 226 | (subscribed . t)) |
| 227 | ("nnimap\\+uw:.*" |
| 228 | (gcc-self . t))) |
| 229 | gnus-large-newsgroup 50 |
| 230 | gnus-home-directory (b/var "gnus/") |
| 231 | gnus-directory (concat gnus-home-directory "news/") |
| 232 | message-directory (concat gnus-home-directory "mail/") |
| 233 | nndraft-directory (concat gnus-home-directory "drafts/") |
| 234 | gnus-save-newsrc-file nil |
| 235 | gnus-read-newsrc-file nil |
| 236 | gnus-interactive-exit nil |
| 237 | gnus-gcc-mark-as-read t) |
| 238 | :config |
| 239 | (when (version< emacs-version "27") |
| 240 | (with-eval-after-load 'nnmail |
| 241 | (add-to-list |
| 242 | 'nnmail-split-abbrev-alist |
| 243 | '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop") |
| 244 | t))) |
| 245 | |
| 246 | ;; (gnus-registry-initialize) |
| 247 | |
| 248 | (with-eval-after-load 'recentf |
| 249 | (add-to-list 'recentf-exclude gnus-home-directory))) |
| 250 | |
| 251 | (use-package gnus-art |
| 252 | :config |
| 253 | (setq |
| 254 | gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)") |
| 255 | gnus-sorted-header-list '("^From:" |
| 256 | "^X-RT-Originator" |
| 257 | "^Newsgroups:" |
| 258 | "^Subject:" |
| 259 | "^Date:" |
| 260 | "^Envelope-To:" |
| 261 | "^Followup-To:" |
| 262 | "^Reply-To:" |
| 263 | "^Organization:" |
| 264 | "^Summary:" |
| 265 | "^Abstract:" |
| 266 | "^Keywords:" |
| 267 | "^To:" |
| 268 | "^[BGF]?Cc:" |
| 269 | "^Posted-To:" |
| 270 | "^Mail-Copies-To:" |
| 271 | "^Mail-Followup-To:" |
| 272 | "^Apparently-To:" |
| 273 | "^Resent-From:" |
| 274 | "^User-Agent:" |
| 275 | "^X-detected-operating-system:" |
| 276 | "^Message-ID:" |
| 277 | ;; "^References:" |
| 278 | "^List-Id:" |
| 279 | "^Gnus-Warning:") |
| 280 | gnus-visible-headers (mapconcat 'identity |
| 281 | gnus-sorted-header-list |
| 282 | "\\|") |
| 283 | ;; local-lapsed article dates |
| 284 | ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11 |
| 285 | gnus-article-date-headers '(user-defined) |
| 286 | gnus-article-time-format |
| 287 | (lambda (time) |
| 288 | (let* ((date (format-time-string "%a, %d %b %Y %T %z" time)) |
| 289 | (local (article-make-date-line date 'local)) |
| 290 | (combined-lapsed (article-make-date-line date |
| 291 | 'combined-lapsed)) |
| 292 | (lapsed (progn |
| 293 | (string-match " (.+" combined-lapsed) |
| 294 | (match-string 0 combined-lapsed)))) |
| 295 | (concat local lapsed)))) |
| 296 | (bind-keys |
| 297 | :map gnus-article-mode-map |
| 298 | ("M-L" . org-store-link))) |
| 299 | |
| 300 | (use-package gnus-sum |
| 301 | :bind (:map gnus-summary-mode-map |
| 302 | :prefix-map b/gnus-summary-prefix-map |
| 303 | :prefix "v" |
| 304 | ("r" . gnus-summary-reply) |
| 305 | ("w" . gnus-summary-wide-reply) |
| 306 | ("v" . gnus-summary-show-raw-article)) |
| 307 | :config |
| 308 | (bind-keys |
| 309 | :map gnus-summary-mode-map |
| 310 | ("M-L" . org-store-link)) |
| 311 | :hook (gnus-summary-mode . b/no-mouse-autoselect-window) |
| 312 | :custom |
| 313 | (gnus-thread-sort-functions '(gnus-thread-sort-by-number |
| 314 | gnus-thread-sort-by-subject |
| 315 | gnus-thread-sort-by-date))) |
| 316 | |
| 317 | (use-package gnus-msg |
| 318 | :config |
| 319 | (defvar b/shemshak-signature "Amin Bandali |
| 320 | https://shemshak.org/~amin") |
| 321 | (defvar b/uw-signature "Amin Bandali, MMath Student |
| 322 | Cheriton School of Computer Science |
| 323 | University of Waterloo |
| 324 | https://bandali.eu.org") |
| 325 | (defvar b/csc-signature "Amin Bandali |
| 326 | System Administrator, Systems Committee |
| 327 | Computer Science Club, University of Waterloo |
| 328 | https://csclub.uwaterloo.ca/~abandali") |
| 329 | (setq gnus-message-replysign t |
| 330 | gnus-posting-styles |
| 331 | '((".*" |
| 332 | (address "bandali@gnu.org")) |
| 333 | ("nnimap\\+gnu:l\\..*" |
| 334 | (signature nil)) |
| 335 | ("nnimap\\+gnu:.*" |
| 336 | (organization "GNU")) |
| 337 | ((header "subject" "ThankCRM") |
| 338 | (to "webmasters-comment@gnu.org") |
| 339 | (body "") |
| 340 | (eval (setq b/message-cite-say-hi nil))) |
| 341 | ("nnimap\\+shemshak:.*" |
| 342 | (address "amin@shemshak.org") |
| 343 | (body "\nBest,\n") |
| 344 | (signature b/shemshak-signature) |
| 345 | (gcc "nnimap+shemshak:Sent") |
| 346 | (eval (setq b/message-cite-say-hi t))) |
| 347 | ("nnimap\\+uw:.*" |
| 348 | (address "bandali@uwaterloo.ca") |
| 349 | (body "\nBest,\n") |
| 350 | (signature b/uw-signature)) |
| 351 | ("nnimap\\+uw:INBOX" |
| 352 | (gcc "\"nnimap+uw:Sent Items\"")) |
| 353 | ("nnimap\\+csc:.*" |
| 354 | (address "bandali@csclub.uwaterloo.ca") |
| 355 | (signature b/csc-signature) |
| 356 | (gcc "nnimap+csc:Sent")))) |
| 357 | :hook (gnus-message-setup . (lambda () |
| 358 | (unless (mml-secure-is-encrypted-p) |
| 359 | (mml-secure-message-sign))))) |
| 360 | |
| 361 | (use-package gnus-topic |
| 362 | :hook (gnus-group-mode . gnus-topic-mode) |
| 363 | :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) |
| 364 | |
| 365 | (use-package gnus-agent |
| 366 | :config |
| 367 | (setq gnus-agent-synchronize-flags 'ask) |
| 368 | :hook (gnus-group-mode . gnus-agent-mode)) |
| 369 | |
| 370 | (use-package gnus-group |
| 371 | :config |
| 372 | (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) |
| 373 | |
| 374 | (comment |
| 375 | ;; problematic with ebdb's popup, *EBDB-Gnus* |
| 376 | (use-package gnus-win |
| 377 | :config |
| 378 | (setq gnus-use-full-window nil))) |
| 379 | |
| 380 | (use-package gnus-dired |
| 381 | :commands gnus-dired-mode |
| 382 | :init |
| 383 | (add-hook 'dired-mode-hook 'gnus-dired-mode)) |
| 384 | |
| 385 | (comment |
| 386 | (use-package gnus-utils |
| 387 | :custom |
| 388 | (gnus-completing-read-function 'gnus-ido-completing-read))) |
| 389 | |
| 390 | (use-package mm-decode |
| 391 | :config |
| 392 | (setq mm-discouraged-alternatives '("text/html" "text/richtext") |
| 393 | mm-decrypt-option 'known |
| 394 | mm-verify-option 'known)) |
| 395 | |
| 396 | (use-package mm-uu |
| 397 | :config |
| 398 | (when (version< "27" emacs-version) |
| 399 | (set-face-attribute 'mm-uu-extract nil :extend t)) |
| 400 | :custom |
| 401 | (mm-uu-diff-groups-regexp |
| 402 | "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)")) |
| 403 | |
| 404 | (use-package mml) |
| 405 | |
| 406 | (use-package mml-sec |
| 407 | :custom |
| 408 | (mml-secure-openpgp-encrypt-to-self t) |
| 409 | (mml-secure-openpgp-sign-with-sender t)) |
| 410 | |
| 411 | (use-package gnus-article-treat-patch |
| 412 | :disabled |
| 413 | :demand |
| 414 | :load-path "lisp/" |
| 415 | :config |
| 416 | ;; note: be sure to customize faces with `:foreground "white"' when |
| 417 | ;; using a theme with a white/light background :) |
| 418 | (setq ft/gnus-article-patch-conditions |
| 419 | '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@"))) |
| 420 | |
| 421 | (provide 'bandali-gnus) |