[Gnus] Move Gnus’ demon configuration to db-mail and init.el

This commit is contained in:
Daniel Borchmann 2019-02-02 15:34:20 +01:00
parent 784f5ce1fd
commit 26b0234b56
Signed by: exot
GPG Key ID: 4F63DB96D45AA9C6
3 changed files with 22 additions and 21 deletions

20
gnus.el
View File

@ -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

View File

@ -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"

View File

@ -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