From b005e99d8d987a68f1b51f078f4a9fc7719a22ff Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 1 Oct 2025 17:24:09 +0100 Subject: gnus for mac --- custom/jao-custom-eww.el | 7 ++++--- custom/jao-custom-gnus.el | 37 +++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el index beeb97e..c388437 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -24,9 +24,10 @@ ;;; multipart html renderer (defun jao-shr-html-renderer (handle) - (let ((fill-column nil) - (shr-width 150) - (shr-max-width 150)) + (let* ((w (min 150 (- (window-width) 10))) + (fill-column nil) + (shr-width w) + (shr-max-width w)) (mm-shr handle))) (setq mm-text-html-renderer #'jao-shr-html-renderer) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index ecf0e52..4535fd3 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -183,20 +183,32 @@ nnml-directory message-directory) (defvar jao-local-mail-sources - (append (mapcar (lambda (f) `(maildir :path ,(expand-file-name f jao-maildir))) + (append (mapcar (lambda (f) + `(maildir :path ,(expand-file-name f jao-maildir))) '("local/" "feeds/")) (jao-when-darwin '((file :path "/var/mail/jao"))))) +(defun jao-pm-label-mail-sources (pwd &rest labels) + (mapcar (lambda (b) + `(imap :server "127.0.0.1" :port 1143 + :user "jaor@pm.me" :password ,pwd + :stream starttls :predicate "1:*" + :fetchflag "\\Deleted \\Seen" + :mailbox ,(concat "Labels/#" b))) + (or labels '("inbox" "drivel" "hacking" "bills" "prog" "words")))) + +(defun jao-pm-folder-mail-sources (pwd &rest folders) + (mapcar (lambda (b) + `(imap :server "127.0.0.1" :port 1143 + :user "jaor@pm.me" :password ,pwd + :stream starttls :predicate "DELETED UNSEEN" + :fetchflag "" + :mailbox ,(if b (concat "Folders/" b) "INBOX"))) + (or folders '(nil "drivel" "hacking" "bills" "prog" "words")))) + (setq mail-sources (let* ((pwd (auth-source-pick-first-password :host "proton-bridge")) - (ims (mapcar (lambda (b) - `(imap :server "127.0.0.1" :port 1143 - :user "jaor@pm.me" :password ,pwd - :stream starttls :predicate "1:*" - :fetchflag "\\Deleted \\Seen" - :mailbox ,(concat "Labels/#" b))) - '("inbox" "drivel" "hacking" "bills" - "bigml" "prog" "words")))) + (ims (jao-pm-label-mail-sources pwd))) (append jao-local-mail-sources ims))) (when jao-gnus-use-nnml @@ -627,11 +639,12 @@ (defun jao-gnus-add-demon () (interactive) - (gnus-demon-add-handler - (jao-d-l 'jao-gnus--scan-local-mail 'jao-gnus--scan) 5 1)) + (gnus-demon-add-handler 'jao-gnus--scan 5 1)) + +(defun jao-gnus-remove-demon () + (gnus-demon-remove-handler 'jao-gnus--scan)) (jao-gnus-add-demon) -;; (gnus-demon-remove-handler 'jao-gnus--scan) (gnus-demon-init) ;; this is, in theory, not needed; but at some point in the way to emacs -- cgit v1.2.3