How to use Gnus Group Topics efficiently

  |   Source

Group Topics is used to manage Gnus groups.

For example, you can,

  • Place groups (mail folders) from Gmail into "gmail" topic
  • Place groups (mails folders) from Outlook.com into "hotmail" topic
  • Make "gmail" and "hotmail" belong to the root topic "Gnus"

Enable it is just one line,

(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)

Now comes the question how to delete/add/move the topics?

The official answer is to read its manual.

But there is a simpler solution. All you need to do is insert below code into ~/.emacs or ~/.gnus.el,

(with-eval-after-load 'gnus-topic
  (setq gnus-topic-topology '(("Gnus" visible)
                              (("hotmail" visible nil nil))
                              (("gmail" visible nil nil))))

  (setq gnus-topic-alist '(("hotmail" ; the key of topic
                            "nnimap+hotmail:Inbox"
                            "nnimap+hotmail:Drafts"
                            "nnimap+hotmail:Sent"
                            "nnimap+hotmail:Junk"
                            "nnimap+hotmail:Deleted")
                           ("gmail" ; the key of topic
                            "INBOX"
                            "[Gmail]/Sent Mail"
                            "[Gmail]/Trash"
                            "Drafts")
                           ("Gnus"))))

The management of topics is as easy as editing above code.

My setup always works no matter ~/.newsrc.eld is loaded or not.

BTW, "hotmail" and "gmail" are the keys you used when configuring IMAP accounts,

(setq gnus-select-method
             '(nnimap "gmail" ; key
                      (nnimap-address "imap.gmail.com")
                      (nnimap-server-port 993)
                      (nnimap-stream ssl)))
(add-to-list 'gnus-secondary-select-methods
             '(nnimap "hotmail" ; key
                      (nnimap-address "imap-mail.outlook.com")
                      (nnimap-server-port 993)
                      (nnimap-stream ssl)))
Comments powered by Disqus