diff --git a/gnus.el b/gnus.el index a7e1bc7..e01af18 100644 --- a/gnus.el +++ b/gnus.el @@ -63,26 +63,6 @@ (nnimap-inbox "INBOX"))))) db/mail-accounts)))) - -;;; Daemons - -(defun db/gnus-demon-scan-news-on-level-2 () - "Scan for news in Gnus on level 2." - ;; from https://www.emacswiki.org/emacs/GnusDemon - (let ((win (current-window-configuration)) - (gnus-read-active-file 'some) - (gnus-check-new-newsgroups nil) - (level 2)) - (while-no-input - (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))))) - -(gnus-demon-add-handler 'db/gnus-demon-scan-news-on-level-2 5 5) - ;;; Mail Formatting diff --git a/init.el b/init.el index c1d4dab..7706070 100644 --- a/init.el +++ b/init.el @@ -1205,7 +1205,8 @@ db/gnus-save-newsrc-with-whitespace-1 db/gnus-summary-open-Link db/gnus-html-mime-part-to-org - db/set-smtp-server-from-header)) + db/set-smtp-server-from-header + db/gnus-demon-scan-news-on-level-2)) (use-package bbdb :commands (bbdb-search-name bbab-initialize bbdb-mua-auto-update-init bbdb-save) @@ -1487,6 +1488,9 @@ (add-hook 'gnus-save-quick-newsrc-hook #'db/gnus-save-newsrc-with-whitespace-1) + ;; Automatically scan for new news + (gnus-demon-add-handler 'db/gnus-demon-scan-news-on-level-2 5 5) + ;; Visit group under point and immediately close it; this updates ;; gnus’ registry as a side-effect (bind-key "v u" diff --git a/site-lisp/db-mail.el b/site-lisp/db-mail.el index 2c067ec..a329ba1 100644 --- a/site-lisp/db-mail.el +++ b/site-lisp/db-mail.el @@ -9,6 +9,7 @@ (require 'mail-extr) (require 'epg) (require 'mml-sec) +(require 'gnus) ;; XXX: This needs some functionality for local accounts (defcustom db/mail-accounts nil @@ -154,5 +155,21 @@ entry of the current mail." (message "Sending with default account settings") (apply orig-fun args))))) +(defun db/gnus-demon-scan-news-on-level-2 () + "Scan for news in Gnus on level 2." + ;; from https://www.emacswiki.org/emacs/GnusDemon + (require 'gnus-start) ; load global variables + (let ((win (current-window-configuration)) + (gnus-read-active-file 'some) + (gnus-check-new-newsgroups nil) + (level 2)) + (while-no-input + (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))))) + (provide 'db-mail) ;;; db-mail ends here