diff options
Diffstat (limited to 'custom/jao-custom-gnus.el')
-rw-r--r-- | custom/jao-custom-gnus.el | 37 |
1 files changed, 25 insertions, 12 deletions
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 |