1

Gnus documentation says

A slightly different approach to foreign groups is to set the gnus-secondary-select-methods variable. The select methods listed in this variable are in many ways just as native as the gnus-select-method server. They will also be queried for active files during startup (if that's required), and new newsgroups that appear on these servers will be subscribed (or not) just as native groups are.

So, if I have

(add-to-list 'gnus-secondary-select-methods
             '(nnimap "imap.first.com"))
(add-to-list 'gnus-secondary-select-methods
             '(nnimap "imap.second.com"))

in my gnus-init-file then Gnus will query imap.first.com and imap.second.com. Querying the servers could take a while for many reasons. How can I prevent Gnus from querying the servers at startup?

2 Answers 2

3

One way to achieve this is by configuring the user option gnus-activate-level, which defaults to 6:

Groups higher than this level won't be activated on startup.

Setting this variable to something low might save lots of time when you have many groups that you aren't interested in.

See the Gnus Manual nodes on Terminology and Group Levels, as well as the EmacsWiki article on Gnus Speed for more information on Gnus group levels.

The default subscribed level of groups is dictated by user option gnus-level-default-subscribed, which defaults to 3:

New subscribed groups will be subscribed at this level.

So, I see a couple of options:

  1. Assume your nnimap groups have been subscribed according to a default gnus-level-default-subscribed, i.e. at level 3. Then, in your gnus-init-file, you can write

    (setq gnus-activate-level (1- gnus-level-default-subscribed))
    

    Note that gnus-activate-level can be more than just one less than gnus-level-default-subscribed, though keep in mind that level numbers are in short supply.

  2. Manually set the levels of your nnimap groups by typing S l over each of them in the group buffer. Then set gnus-activate-level in your gnus-init-file to a value at least one less than the value you gave the groups, as in option 1.

Either way, after startup you can instruct Gnus to scan for new mail by passing a numeric prefix argument equal to the level of your nnimap groups to the g command (gnus-group-get-new-news) in the group buffer, e.g. by typing 3 g.

2

Minor addition: even if you set all the groups' levels on the given server to something lower than gnus-activate-level, or do not have any subscribed groups on this server at all, Gnus will still query this server on startup.

This is because by default Gnus queries this server for the presence of new groups.

E.g., here is what I get in the message buffer on startup (say, my gnus-secondary-select-methods are set to ((nntp "news.gwene.org"))):

Opening nntp server on news.gwene.org

No new newsgroups

This is pretty costly if you have many secondary servers, so better prevent this behavior by setting gnus-check-new-newsgroups to nil.

1
  • I put important stuff on level 2 or 1, and (setq gnus-check-new-newsgroups nil) (setq gnus-activate-level 2) (defun my-gnus-group-activate-on-idle () "After some idle time, check for new groups & activate groups to level 3." (run-with-idle-timer 5 nil (lambda () (gnus-find-new-newsgroups) (gnus-activate-all-groups 3)))) (add-hook 'gnus-group-mode-hook #'my-gnus-group-activate-on-idle) so it fetches it when I'm off writing stackexchange comments.
    – unhammer
    Commented Nov 29, 2023 at 10:52

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.