* lisp/bandali-erc.el: add pals, show erc-track message counts
[~bandali/configs] / lisp / bandali-gnus.el
index f3fa118..88b05bd 100644 (file)
@@ -1,3 +1,29 @@
+;;; bandali-gnus.el --- bandali's Gnus setup         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018-2020  Amin Bandali
+
+;; Author: Amin Bandali <bandali@gnu.org>
+;; Keywords: mail, news
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; My trusty super awesome Gnus setup.
+
+;;; Code:
+
 (defvar b/maildir (expand-file-name "~/mail/"))
 (with-eval-after-load 'recentf
   (add-to-list 'recentf-exclude b/maildir))
 (defvar b/maildir (expand-file-name "~/mail/"))
 (with-eval-after-load 'recentf
   (add-to-list 'recentf-exclude b/maildir))
@@ -32,7 +58,7 @@
              (nnimap-address "127.0.0.1")
              (nnimap-server-port 143)
              (nnimap-authenticator plain)
              (nnimap-address "127.0.0.1")
              (nnimap-server-port 143)
              (nnimap-authenticator plain)
-             (nnimap-user "amin@shemshak.local"))
+             (nnimap-user "bandali@shemshak.local"))
      (nnimap "gnu"
              (nnimap-stream plain)
              (nnimap-address "127.0.0.1")
      (nnimap "gnu"
              (nnimap-stream plain)
              (nnimap-address "127.0.0.1")
@@ -50,6 +76,8 @@
                                   (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
                                   ;; libreplanet
                                   (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
                                   (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
                                   ;; libreplanet
                                   (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
+                                  ;; iana (e.g. tz-announce)
+                                  (list ".*<\\(.*\\)\\.iana\\.org>.*" "l.\\1")
                                   ;; *.lists.sr.ht, omitting one dot if present
                                   ;;    add more \\.?\\([^.]*\\) if needed
                                   (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
                                   ;; *.lists.sr.ht, omitting one dot if present
                                   ;;    add more \\.?\\([^.]*\\) if needed
                                   (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
                                   ;; ----------------------------------
                                   ;; legend: (u)nsubscribed | (d)ead
                                   ;; ----------------------------------
                                   ;; ----------------------------------
                                   ;; legend: (u)nsubscribed | (d)ead
                                   ;; ----------------------------------
+                                  ;; spam
+                                  ("X-Spam_action" "reject" "Junk")
                                   ;; otherwise, leave mail in INBOX
                                   "INBOX")))
                                   ;; otherwise, leave mail in INBOX
                                   "INBOX")))
-     (nnimap "uw"
+     (nnimap "uwaterloo"
              (nnimap-stream plain)
              (nnimap-address "127.0.0.1")
              (nnimap-server-port 143)
              (nnimap-authenticator plain)
              (nnimap-stream plain)
              (nnimap-address "127.0.0.1")
              (nnimap-server-port 143)
              (nnimap-authenticator plain)
-             (nnimap-user "abandali@uw.local")
+             (nnimap-user "abandali@uwaterloo.local")
              (nnimap-inbox "INBOX")
              (nnimap-split-methods 'nnimap-split-fancy)
              (nnimap-split-fancy (|
              (nnimap-inbox "INBOX")
              (nnimap-split-methods 'nnimap-split-fancy)
              (nnimap-split-fancy (|
              (nnimap-address "127.0.0.1")
              (nnimap-server-port 143)
              (nnimap-authenticator plain)
              (nnimap-address "127.0.0.1")
              (nnimap-server-port 143)
              (nnimap-authenticator plain)
-             (nnimap-user "abandali@csc.uw.local")))
+             (nnimap-user "abandali@csclub.uwaterloo.local")
+             (nnimap-inbox "INBOX")
+             (nnimap-split-methods 'nnimap-split-fancy)
+             (nnimap-split-fancy (|
+                                  ;; cron reports and other messages from root
+                                  (from "root@\\(.*\\.\\)?csclub\\.uwaterloo\\.ca" "INBOX")
+                                  ;; spam
+                                  ("X-Spam-Flag" "YES" "Junk")
+                                  ;; catch-all
+                                  "INBOX"))))
    gnus-message-archive-group "nnimap+gnu:INBOX"
    gnus-parameters
    '(("l\\.atreus"
    gnus-message-archive-group "nnimap+gnu:INBOX"
    gnus-parameters
    '(("l\\.atreus"
       (gcc-self . t))
      ("l\\."
       (subscribed . t))
       (gcc-self . t))
      ("l\\."
       (subscribed . t))
-     ("nnimap\\+uw:.*"
+     ("nnimap\\+uwaterloo:.*"
       (gcc-self . t)))
    gnus-large-newsgroup  50
    gnus-home-directory   (b/var "gnus/")
       (gcc-self . t)))
    gnus-large-newsgroup  50
    gnus-home-directory   (b/var "gnus/")
        '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
        t)))
 
        '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
        t)))
 
+  ;; (require 'gnus-registry)
+  ;; (setq gnus-registry-max-entries 2500)
+  ;; (setq gnus-registry-ignored-groups
+  ;;       (append gnus-registry-ignored-groups
+  ;;               '(("^nnimap:gnu\\.l" t)
+  ;;                 ("webmasters$" t))))
   ;; (gnus-registry-initialize)
 
   (with-eval-after-load 'recentf
   ;; (gnus-registry-initialize)
 
   (with-eval-after-load 'recentf
                              "^Resent-From:"
                              "^User-Agent:"
                              "^X-detected-operating-system:"
                              "^Resent-From:"
                              "^User-Agent:"
                              "^X-detected-operating-system:"
+                             "^X-Spam_action:"
+                             "^X-Spam_bar:"
                              "^Message-ID:"
                              ;; "^References:"
                              "^List-Id:"
                              "^Message-ID:"
                              ;; "^References:"
                              "^List-Id:"
 (use-package gnus-msg
   :config
   (defvar b/shemshak-signature "Amin Bandali
 (use-package gnus-msg
   :config
   (defvar b/shemshak-signature "Amin Bandali
-https://shemshak.org/~amin")
-  (defvar b/uw-signature "Amin Bandali, MMath Student
+https://shemshak.org/~bandali")
+  (defvar b/uwaterloo-signature "Amin Bandali, MMath
 Cheriton School of Computer Science
 University of Waterloo
 Cheriton School of Computer Science
 University of Waterloo
-https://bandali.eu.org")
-  (defvar b/csc-signature "Amin Bandali
+https://bndl.org")
+  (defvar b/csc-signature "Amin Bandali | https://bndl.org
 System Administrator, Systems Committee
 System Administrator, Systems Committee
-Computer Science Club, University of Waterloo
-https://csclub.uwaterloo.ca/~abandali")
+Computer Science Club, University of Waterloo")
   (setq gnus-message-replysign t
         gnus-posting-styles
         '((".*"
   (setq gnus-message-replysign t
         gnus-posting-styles
         '((".*"
@@ -344,12 +390,12 @@ https://csclub.uwaterloo.ca/~abandali")
            (signature b/shemshak-signature)
            (gcc "nnimap+shemshak:Sent")
            (eval (setq b/message-cite-say-hi t)))
            (signature b/shemshak-signature)
            (gcc "nnimap+shemshak:Sent")
            (eval (setq b/message-cite-say-hi t)))
-          ("nnimap\\+uw:.*"
+          ("nnimap\\+uwaterloo:.*"
            (address "bandali@uwaterloo.ca")
            (body "\nBest,\n")
            (address "bandali@uwaterloo.ca")
            (body "\nBest,\n")
-           (signature b/uw-signature))
-          ("nnimap\\+uw:INBOX"
-           (gcc "\"nnimap+uw:Sent Items\""))
+           (signature b/uwaterloo-signature))
+          ("nnimap\\+uwaterloo:INBOX"
+           (gcc "\"nnimap+uwaterloo:Sent Items\""))
           ("nnimap\\+csc:.*"
            (address "bandali@csclub.uwaterloo.ca")
            (signature b/csc-signature)
           ("nnimap\\+csc:.*"
            (address "bandali@csclub.uwaterloo.ca")
            (signature b/csc-signature)
@@ -408,4 +454,15 @@ https://csclub.uwaterloo.ca/~abandali")
   (mml-secure-openpgp-encrypt-to-self t)
   (mml-secure-openpgp-sign-with-sender t))
 
   (mml-secure-openpgp-encrypt-to-self t)
   (mml-secure-openpgp-sign-with-sender t))
 
+(use-package gnus-article-treat-patch
+  :disabled
+  :demand
+  :load-path "lisp/"
+  :config
+  ;; note: be sure to customize faces with `:foreground "white"' when
+  ;; using a theme with a white/light background :)
+  (setq ft/gnus-article-patch-conditions
+        '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))
+
 (provide 'bandali-gnus)
 (provide 'bandali-gnus)
+;;; bandali-gnus.el ends here