Re: Agent and IMAP

James Thomas <[email protected]> Mon, 04 Nov 2024 06:16:26 +0530
Newsgroups gmane.emacs.gnus.general
Message-ID <[email protected]>
James Thomas wrote:

> (defun my/gnus-demon-scan-mail ()
>   (gnus-agent-while-plugged
>     ;; Only level 3 servers should be agentized, for this.
>     (gnus-agent-synchronize-flags)
>     ;; Inbox.
>     (gnus-group-get-new-news 3 t)
>     (with-temp-message ""
>       ;; Spam.
>       (gnus-group-get-new-news 4 t)
>       (gnus-agent-fetch-session))
>     (unless (equal (current-message) gnus-no-groups-message)
>       ;; Custom alert function.
>       (alert))
>     (call-interactively #'gnus-group-list-groups)))

Actually, this is the function I used to use:

--8<---------------cut here---------------start------------->8---

(defun my/gnus-demon-scan-mail ()
  (gnus-agent-while-plugged
    ;; Get marked.
    (gnus-agent-fetch-session)
    (gnus-agent-possibly-synchronize-flags)
    (gnus-group-get-new-news 4 t)
    (with-temp-message ""
      ;; Get new headers.
      (gnus-agent-fetch-session))
    (unless (equal (current-message)
		   gnus-no-groups-message)
      (alert))))

--8<---------------cut here---------------end--------------->8---

I'd removed some stuff that I (wrongly) thought unnecessary. Also, these
are in my .gnus.el:

(setq gnus-agent-synchronize-flags t)
(setq gnus-agent-go-online t)

And the default (info "(gnus) Agent Categories") was changed from
'short' to 'false'.

Just FYI.

Regards,
James