From 72d89a3bb34d9827eabfa34767a22affe07bcd2d Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 24 May 2024 23:38:34 +0100 Subject: gnus nits --- custom/jao-custom-gnus.el | 117 ++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 77 deletions(-) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index b7eb851..e5a1762 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -9,6 +9,8 @@ (defvar jao-gnus-use-nnml nil) (defvar jao-gnus-use-maildirs nil) (defvar jao-notmuch-enabled nil) +(defvar jao-gnus-nnml-group-params nil) + ;;; directories (defun jao-gnus-dir (dir) (expand-file-name dir gnus-home-directory)) @@ -203,71 +205,6 @@ `(nnml "" (gnus-search-engine gnus-search-recoll (remove-prefix ,(jao-gnus-dir "Mail/")))))) -(defvar jao-gnus-nnml-group-params - `(("nnml:\\(local\\|trash\\|spam\\)" - (auto-expire . t) - (total-expire . t) - (expiry-wait . 1) - (expiry-target . delete)) - ("nnml:jao\\..*" - (posting-style ("Gcc" "nnml:jao.trove")) ;; ("Bcc" "proton@jao.io") - (jao-gnus--trash-group "nnml:trash") - (jao-gnus--spam-group "nnml:spam") - (jao-gnus--archiving-group "nnml:jao.trove") - (gcc-self . t)) - ("nnml:jao\\.hacking" - (posting-style ("Gcc" "nnml:jao.hacking") - (address "jao@gnu.org"))) ;; ("Bcc" "hacking@jao.io") - ("nnml:jao\\.drivel" - (auto-expire . t) - (total-expire . t) - (expiry-wait . 3) - (expiry-target . delete)) - ("nnml:bigml\\..*" - (gcc-self . nil) - (auto-expire . t) - (total-expire . t) - (expiry-wait . 3) - (expiry-target . delete) - (posting-style (address "jao@bigml.com")) - (jao-gnus--trash-group "nnml:trash") - (jao-gnus--spam-group "nnml:spam") - (jao-gnus--archiving-group "nnml:bigml.trove")) - ("nnml:bigml\\.inbox" - (gcc-self . t) - (auto-expire . t) - (total-expire . t) - (expiry-wait . 7) - (expiry-target . "nnml:bigml.trove")) - ("nnml:bigml\\.alba" - (gcc-self . t) - (auto-expire . nil) - (total-expire . nil) - (expiry-target . nil) - (expiry-wait . nil)) - ("nnml:bigml\\.trove" - (auto-expire . t) - (total-expire . t) - (expiry-target . delete) - (expiry-wait . 365)) - ("nnml:feeds\\.\\(.*\\)" - (posting-style ("Gcc" "nnml:feeds.trove") - (address "jao@gnu.org")) - (auto-expire . t) - (total-expire . t) - (expiry-wait . 7) - (expiry-target . delete) - (comment . "feeds.\\1") - (jao-gnus--archiving-group "nnml:feeds.trove")) - ("nnml:feeds\\.\\(news\\|emacs-\\(bugs\\|diffs|\\github\\)\\)$" - (expiry-wait . 2)) - ("nnml:feeds\\.trove" - (auto-expire . nil) - (total-expire . nil)) - ("nnml:feeds\\.fun" - (mm-html-inhibit-images nil) - (mm-html-blocked-images nil)))) - (when jao-gnus-use-nnml (dolist (p jao-gnus-nnml-group-params) (add-to-list 'gnus-parameters p t))) @@ -291,7 +228,8 @@ '(nnimap "gandi" (nnimap-address "mail.gandi.net")))) ;;; groups -(setq gnus-group-line-format " %m%S%p%3y%P%* %~(pad-right 30)G %B\n" +(setq gnus-group-line-format + " %m%S%p%3y%P%* %~(pad-right 30)G %B\n" ;; " %m%S%p%P:%~(pad-right 35)c %3y %B\n" ;; " %m%S%p%3y%P%* %~(pad-right 30)C %B\n" gnus-topic-line-format "%i[ %(%{%n%}%) -- %A ]%v\n" @@ -302,6 +240,25 @@ (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp) (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) +;;; rss +(setq nnrss-use-local t ;; M-x nnrss-generate-download-script + nnrss-ignore-article-fields '(category + dc:creator + dc:date + enclosure + guid + link + media:content + media:thumbnail + media:title + post-id + pubDate + slash:comments)) + +(add-to-list 'gnus-parameters `(,(format "nnrss:%s.*" + (regexp-opt jao-gnus-image-groups t)) + (mm-html-inhibit-images nil) + (mm-html-blocked-images nil))) ;;; summary ;;;; configuration (setq gnus-summary-ignore-duplicates t @@ -319,8 +276,8 @@ gnus-summary-make-false-root 'adopt gnus-summary-gather-subject-limit nil ;; 120 gnus-summary-thread-gathering-function #'gnus-gather-threads-by-subject - gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number - gnus-thread-sort-functions '(gnus-thread-sort-by-number)) + gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date + gnus-thread-sort-functions '(gnus-thread-sort-by-date)) (defun jao-fix-protonmail-references (header) (let ((references (mail-header-references header))) @@ -635,18 +592,18 @@ ("nnml:jao\\.\\(inbox\\|trove\\)" "I" jao-themes-f01) ("nnml:bigml\\.[^ibs]" "W" jao-themes-dimm) ("nnml:jao.hacking" "H" jao-themes-dimm) - ("nnml:jao.[^isth]" "J" jao-themes-dimm) + ("nnml:jao.write" "W" jao-themes-error) + ("nnml:jao.[^isthw]" "J" jao-themes-dimm) (,(format "^nnml:%s" (regexp-opt feeds)) "F" jao-themes-dimm) ("feeds\\.e" "E" jao-themes-dimm) - ("nnml:local" "l" jao-themes-dimm)))) + ("nnml:local" "l" jao-themes-dimm) + ("nnrss:.*" "R" jao-themes-dimm) + ("^\\(gwene\\|gmane\\)\\." "N" jao-themes-dimm)))) (defun jao-gnus--unread-counts () (seq-reduce (lambda (r g) (let ((n (gnus-group-unread (car g)))) - (if (and (numberp n) (> n 0)) - (prog1 (cons (cons (car g) n) r) - (gnus-message 7 "%s in %s" n g)) - r))) + (if (and (numberp n) (> n 0)) (cons (cons (car g) n) r) r))) gnus-newsrc-alist ())) @@ -674,12 +631,18 @@ (jao-minibuffer-add-variable 'jao-gnus--notify-strs -20)) (add-hook 'gnus-started-hook #'jao-gnus--notify) -(add-hook 'gnus-summary-exit-hook #'jao-gnus--notify) +;; (add-hook 'gnus-summary-exit-hook #'jao-gnus--notify) (add-hook 'gnus-after-getting-new-news-hook #'jao-gnus--notify) -;;;;; agenda updates -(add-hook 'gnus-summary-exit-hook #'jao-org-agenda) +;;;;; agenda and other updates on summary exit +(let ((exit-count 0)) + (defun jao-gnus--on-summary-exit () + (when (> (setq exit-count (+ 1 exit-count)) 20) + (setq exit-count 0) + (jao-org-agenda)) + (jao-gnus--notify))) +(add-hook 'gnus-summary-exit-hook #'jao-gnus--on-summary-exit) ;;;; open mail file in gnus (defun jao-gnus-file-to-group (file &optional maildir newsdir m-server n-server) -- cgit v1.2.3