1

I have the following in my ~/.gnus:

(gnus-demon-add-handler, 'gnus-demon-scan-mail 5 t)
(gnus-demon-init)

I expect that gnus will be checking for new emails every 5 min, however this doesn't happen. What am I doing wrong?

2
  • 6
    you should remove the comma after gnus-demon-add-handler
    – DJJ
    Commented Dec 9, 2016 at 21:48
  • 1
    Have you tried gnus-demon-scan-news instead of gnus-demon-scan-mail? At first glance the latter does not seem to cover all backends, e.g. nnimap, which is what I use.
    – Basil
    Commented May 9, 2017 at 0:40

1 Answer 1

1

Are you using nnmaildir or nnml? It seems to me that the daemon does not work for nnmaildir. Can someone confirm please.

Here is the code for gnus-demon-scan-mail

(defun gnus-demon-scan-mail ()
  (save-window-excursion
(let ((servers gnus-opened-servers)
  server
  (nnmail-fetched-sources (list t)))
  (while (setq server (car (pop servers)))
(and (gnus-check-backend-function 'request-scan (car server))
     (or (gnus-server-opened server)
     (gnus-open-server server))
     (gnus-request-scan nil server))))))

Edit I have found these two functions on the gnus mailing list. They are really helpful to understand how things work.

;;; * check new mail
;;; ** function def
(defun gnus-demon-scan-mail-or-news-and-update (level)
"Scan for new mail, updating the *Group* buffer."
  (let ((win (current-window-configuration)))
    (unwind-protect
        (save-window-excursion
          (save-excursion
            (when (gnus-alive-p)
              (save-excursion
                (set-buffer gnus-group-buffer)
                (gnus-group-get-new-news level)))))
      (message "scanning for new mail done")
      (set-window-configuration win))))

(defun gnus-demon-scan-news-and-update ()
"Scan for new mail, updating the *Group* buffer."
  (gnus-demon-scan-mail-or-news-and-update 3))

;;; ** command
(gnus-demon-add-handler 'gnus-demon-scan-news-and-update 10 nil)
(gnus-demon-add-handler 'gnus-demon-scan-mail 10 nil)
(gnus-demon-init)

And I'm using nnml as my mail back-end with procmail and fetchmail

(setq gnus-select-method '(nnml ""))
(setq mail-sources  '((file :path "~/.mail/inbox.spool")
          ))

For mail notification you can use this https://stackoverflow.com/a/9611516/2081427 The you get notified in the mode-line each time a mail new mail comes.

Note I couldn't make gnus-notify.el work for more than one group. So as far as I know if you use nnmail-split-methods and want gnus-notify.el for more than one group it won't work.

4
  • 1
    I use multiple nnimap backends as gnus-secondary-select-methods with no gnus-select-metho and gnus-demon-scan-mail does not work OOTB for me. Instead, I rescan for mail with gnus-demon-scan-news.
    – Basil
    Commented May 9, 2017 at 1:11
  • Thanks for the feed-back. I've updated my post wiht my current knowledge on the matter. cheers
    – DJJ
    Commented May 9, 2017 at 18:53
  • Just to be clear - gnus-demon-scan-news and gnus-demon-scan-mail are built-in functions of gnus-demon.el. Also the built-in gnus-notify.el is a different package than the third-party gnus-desktop-notify.el package which you linked.
    – Basil
    Commented May 9, 2017 at 19:05
  • Apologies, I mixed up the third-party gnus-notify.el with the built-in gnus-notifications.el, which you may be interested in.
    – Basil
    Commented May 9, 2017 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.