I use gnus for email, including its built-in message-mode for composing/replying to email. Just before sending mail, I'd like to query my IMAP server to see if there have been any new messages on this thread since I started composing.

It looks like I can do my check in a message-send-hook function, but what API can I use to check for new mail on a thread? Does gnus provide any interface for this? I'd like to avoid dropping to IMAP directly since I might not always be using IMAP...

  • How about creating a custom function called check-messages-and-send-email-maybe -- where the first line is the function to check messages; the second line is a (when (yes-or-no-p . . .; the third line is a switch-to-buffer [email-composing-buffer] or set-buffer . . .; and, the fourth line is your send email function. Lines 3 and 4 for are a continuation of the yes/no statement. Set your new function to your favorite keyboard shortcut.
    – lawlist
    Feb 3, 2015 at 2:00

1 Answer 1


You can do a generic scan for any Gnus backend. Look at gnus-group-get-new-news-this-group:

gnus-group-get-new-news-this-group is an interactive compiled Lisp
function in `gnus-group.el'.

(gnus-group-get-new-news-this-group &optional N DONT-SCAN)

Check for newly arrived news in the current group (and the N-1 next groups).
The difference between N and the number of newsgroup checked is returned.
If N is negative, this group and the N-1 previous groups will be checked.
If DONT-SCAN is non-nil, scan non-activated groups as well.

It won't tell you about just the current thread, though. Gnus threading is pretty flexible and happens late in the game, so you don't know what thread the article will go into. For that, you should just do a full refresh like in M-g:

M-g (translated from <escape> g) runs the command
gnus-summary-rescan-group (found in gnus-summary-mode-map), which is
an interactive compiled Lisp function in

It is bound to M-g, Z G, <menu-bar> <Gnus> <Exit> <Rescan group>.

(gnus-summary-rescan-group &optional ALL)

Exit the newsgroup, ask for new articles, and select the newsgroup.

...but that complicates things much more, so I would just use gnus-group-get-new-news-this-group.

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.