diff options
-rw-r--r-- | custom/jao-custom-gnus.el | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index cffedb6..d53adb7 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -182,11 +182,12 @@ nnml-get-new-mail t nnml-directory message-directory) +(defvar jao-local-mail-sources + (mapcar (lambda (f) `(maildir :path ,(expand-file-name f jao-maildir))) + '("local/" "feeds/"))) + (setq mail-sources (let* ((pwd (auth-source-pick-first-password :host "proton-bridge")) - (mds (mapcar (lambda (f) - `(maildir :path ,(expand-file-name f jao-maildir))) - '("local/" "feeds/"))) (ims (mapcar (lambda (b) `(imap :server "127.0.0.1" :port 1143 :user "jaor@pm.me" :password ,pwd @@ -195,7 +196,7 @@ :mailbox ,(concat "Labels/#" b))) '("inbox" "drivel" "hacking" "bills" "bigml" "prog" "words")))) - (append mds ims))) + (append jao-local-mail-sources ims))) (when jao-gnus-use-nnml (add-to-list @@ -611,34 +612,21 @@ (require 'gnus-demon) -(defvar jao-gnus-scan-level 2) - -(defun jao-gnus--scan-level (level) - (let ((win (current-window-configuration))) - (unwind-protect - (save-window-excursion - (when (gnus-alive-p) - (with-current-buffer gnus-group-buffer - (gnus-group-get-new-news level)))) - (set-window-configuration win)))) - (defun jao-gnus--scan () (let ((inhibit-message t)) - (jao-gnus--scan-level jao-gnus-scan-level) + (gnus-demon-scan-news) (jao-gnus--notify))) -(defun jao-gnus-demon-scan-level (level) - (let ((win (current-window-configuration))) - (unwind-protect - (save-window-excursion - (when (gnus-alive-p) - (with-current-buffer gnus-group-buffer - (gnus-group-get-new-news level t)))) - (set-window-configuration win)))) +(defun jao-gnus--scan-local-mail () + (let ((inhibit-message t)) + (let ((mail-sources jao-local-mail-sources)) + (gnus-demon-scan-mail)) + (jao-gnus--notify))) (defun jao-gnus-add-demon () (interactive) - (gnus-demon-add-handler 'jao-gnus--scan 5 1)) + (gnus-demon-add-handler + (jao-d-l 'jao-gnus--scan-local-mail 'jao-gnus--scan) 5 1)) (jao-gnus-add-demon) ;; (gnus-demon-remove-handler 'jao-gnus--scan) |