emacs: gnus: fix se212 folder name in split rules
[~bandali/configs] / .emacs.d / init.el
index 94b9810..eb634df 100644 (file)
@@ -471,6 +471,9 @@ For disabling the behaviour for certain buffers and/or modes."
         org-startup-folded 'content
         org-catch-invisible-edits 'show-and-error
         org-log-done 'time)
+  (when (version< org-version "9.3")
+    (setq org-email-link-description-format
+          org-link-email-description-format))
   (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
   (add-to-list 'org-modules 'org-habit)
   :bind
@@ -1598,19 +1601,23 @@ For disabling the behaviour for certain buffers and/or modes."
                                  ;; (: gnus-registry-split-fancy-with-parent)
                                  ;; (: gnus-group-split-fancy "INBOX" t "INBOX")
                                  ;; gnu
-                                 (list "\\(.*\\).gnu.org" "l.\\1")
+                                 (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
+                                 ;; *@lists.sr.ht, omitting one dot if present
+                                 ;;    add more \\.?\\([^.@]*\\) if needed
+                                 (list ".*<~\\(.*\\)/\\([^.@]*\\)\\.?\\([^.@]*\\)@lists.sr.ht>.*" "l.~\\1.\\2\\3")
                                  ;; webmasters
                                  (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
-                                 ;; haskell
-                                 (list ".*haskell-art.we.lurk.org" "l.haskell.art")
-                                 (list ".*haskell-cafe.haskell.org" "l.haskell.cafe")
                                  ;; other
                                  (list ".*atreus.freelists.org" "l.atreus")
                                  (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
-                                 (list ".*notmuch.notmuchmail.org" "l.notmuch")
-                                 (list ".*dev.lists.parabola.nu" "l.parabola-dev")
-                                 ;; *@lists.sr.ht
-                                 (list ".*~\\(.*\\)/\\(.*\\)@lists.sr.ht" "l.~\\1.\\2")
+                                 ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
+                                 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
+                                 ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
+                                 ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
+                                 ;; ----------------------------------
+                                 ;; legend: (u)nsubscribed | (d)ead
+                                 ;; ----------------------------------
+                                 ;; otherwise, leave mail in INBOX
                                  "INBOX")))
      (nnimap "uw"
              (nnimap-stream plain)
@@ -1622,9 +1629,9 @@ For disabling the behaviour for certain buffers and/or modes."
              (nnimap-split-methods 'nnimap-split-fancy)
              (nnimap-split-fancy (|
                                   ;; (: gnus-registry-split-fancy-with-parent)
-                                  ;; se463-s19
-                                  ("subject" "\\(SE\\s-?463\\|Deliverable\\)" "course.se463-s19")
-                                  (from "\\(SE\\s-?463\\|Gema\\|Hemant\\|Davood\\|Camilo\\|Reza\\|Michael\\|Sandy\\)" "course.se463-s19")
+                                  ;; se212-f19
+                                  ("subject" "SE\\s-?212" "course.se212-f19")
+                                  (from "SE\\s-?212" "course.se212-f19")
                                   ;; catch-all
                                   "INBOX")))
      (nnimap "csc"
@@ -1671,6 +1678,18 @@ For disabling the behaviour for certain buffers and/or modes."
       (to-address . "fencepost-users@gnu.org")
       (to-list    . "fencepost-users@gnu.org")
       (list-identifier . "\\[Fencepost-users\\]"))
+     ("l\\.gnewsense-art"
+      (to-address . "gnewsense-art@nongnu.org")
+      (to-list    . "gnewsense-art@nongnu.org")
+      (list-identifier . "\\[gNewSense-art\\]"))
+     ("l\\.gnewsense-dev"
+      (to-address . "gnewsense-dev@nongnu.org")
+      (to-list    . "gnewsense-dev@nongnu.org")
+      (list-identifier . "\\[Gnewsense-dev\\]"))
+     ("l\\.gnewsense-users"
+      (to-address . "gnewsense-users@nongnu.org")
+      (to-list    . "gnewsense-users@nongnu.org")
+      (list-identifier . "\\[gNewSense-users\\]"))
      ("l\\.gnunet-developers"
       (to-address . "gnunet-developers@gnu.org")
       (to-list    . "gnunet-developers@gnu.org")
@@ -1770,6 +1789,12 @@ For disabling the behaviour for certain buffers and/or modes."
   (require 'ebdb-mua)
   (require 'ebdb-gnus)
 
+  (when (version< emacs-version "27")
+    (add-to-list
+     'nnmail-split-abbrev-alist
+     '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop")
+     t))
+
   ;; (gnus-registry-initialize)
 
   (with-eval-after-load 'recentf
@@ -1825,15 +1850,15 @@ https://shemshak.org/~amin")
   (defvar b/gnu-signature "Amin Bandali
 Free Software Activist | GNU Webmaster & Volunteer
 GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
-https://bandalis.org")
+https://bandali.eu.org")
   (defvar b/uw-signature "Amin Bandali, MMath Student
 Cheriton School of Computer Science
 University of Waterloo
-https://bandalis.org")
+https://bandali.eu.org")
   (defvar b/csc-signature "Amin Bandali
-Termcom, Computer Science Club
-University of Waterloo
-https://bandalis.org")
+Systems Committee
+Computer Science Club, University of Waterloo
+https://csclub.uwaterloo.ca/~abandali")
   (setq gnus-posting-styles
         '((".*"
            (address "amin@shemshak.org")
@@ -2065,7 +2090,80 @@ https://bandalis.org")
   (add-to-list 'erc-modules 'notifications)
   (add-to-list 'erc-modules 'spelling)
   (add-to-list 'erc-modules 'scrolltoplace)
-  (erc-update-modules))
+  (erc-update-modules)
+
+  (when (and (version<= "24.4" emacs-version)
+             (version<         emacs-version "27"))
+    ;; fix erc-lurker bug
+    ;; patch submitted: https://bugs.gnu.org/36843#10
+    ;; TODO: remove when patch is merged and emacs 27 is released
+    (defvar erc-message-parsed)
+    (defun erc-display-message (parsed type buffer msg &rest args)
+      "Display MSG in BUFFER.
+
+ARGS, PARSED, and TYPE are used to format MSG sensibly.
+
+See also `erc-format-message' and `erc-display-line'."
+      (let ((string (if (symbolp msg)
+                        (apply #'erc-format-message msg args)
+                      msg))
+            (erc-message-parsed parsed))
+        (setq string
+              (cond
+               ((null type)
+                string)
+               ((listp type)
+                (mapc (lambda (type)
+                        (setq string
+                              (erc-display-message-highlight type string)))
+                      type)
+                string)
+               ((symbolp type)
+                (erc-display-message-highlight type string))))
+
+        (if (not (erc-response-p parsed))
+            (erc-display-line string buffer)
+          (unless (erc-hide-current-message-p parsed)
+            (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
+            (erc-put-text-property 0 (length string) 'rear-sticky t string)
+            (when (erc-response.tags parsed)
+              (erc-put-text-property 0 (length string) 'tags (erc-response.tags parsed)
+                                     string))
+            (erc-display-line string buffer)))))
+
+    (defun erc-lurker-update-status (_message)
+      "Update `erc-lurker-state' if necessary.
+
+This function is called from `erc-insert-pre-hook'.  If the
+current message is a PRIVMSG, update `erc-lurker-state' to
+reflect the fact that its sender has issued a PRIVMSG at the
+current time.  Otherwise, take no action.
+
+This function depends on the fact that `erc-display-message'
+lexically binds `erc-message-parsed', which is used to check if
+the current message is a PRIVMSG and to determine its sender.
+See also `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'.
+
+In order to limit memory consumption, this function also calls
+`erc-lurker-cleanup' once every `erc-lurker-cleanup-interval'
+updates of `erc-lurker-state'."
+      (when (and (boundp 'erc-message-parsed)
+                 (erc-response-p erc-message-parsed))
+        (let* ((command (erc-response.command erc-message-parsed))
+               (sender
+                (erc-lurker-maybe-trim
+                 (car (erc-parse-user (erc-response.sender erc-message-parsed)))))
+               (server
+                (erc-canonicalize-server-name erc-server-announced-name)))
+          (when (equal command "PRIVMSG")
+            (when (>= (cl-incf erc-lurker-cleanup-count)
+                      erc-lurker-cleanup-interval)
+              (setq erc-lurker-cleanup-count 0)
+              (erc-lurker-cleanup))
+            (unless (gethash server erc-lurker-state)
+              (puthash server (make-hash-table :test 'equal) erc-lurker-state))
+            (puthash sender (current-time)
+                     (gethash server erc-lurker-state))))))))
 
 (use-package erc-fill
   :after erc