Gnus

Table of Contents

In emacs, <DEL> means backspace, <delete> means the delete key.

1 Gmail Setup

Add the credential information to ~/.authinfo

machine imap.gmail.com login <username> password <password> port 993
machine smtp.gmail.com login <username> password <password> port 587

To configure multiple IMAP client for gnus:

machine gmail login [email protected] password <PASSWORD> port 993
machine cymail login [email protected] password <PASSWORD> port 993

Add the following into .gnus

(setq user-mail-address "[email protected]"
      user-full-name "Hebi Li")

(setq gnus-select-method
      '(nnimap "gmail"
	       (nnimap-address "imap.gmail.com")  ; it could also be imap.googlemail.com if that's your server.
	       (nnimap-server-port "imaps")
	       (nnimap-stream ssl)))

(setq smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")


;; send mail using gmail smtp, no require for installation of sendmail or something
(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
      smtpmail-auth-credentials '(("smtp.gmail.com" 587 "[email protected]" nil))
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      starttls-use-gnutls t)

2 gmane news group setting

(setq gnus-default-nntp-server "news.gmane.org")
(setq gnus-select-method '(nntp "news.gmane.org"))
(setq gnus-use-adaptive-scoring t)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)

3 Usage

Inside emacs, run gnus command. This brings the *Group* buffer. You will see the list of groups, use <spc> or <enter> to enter the group. As usual, g to refresh. q for quit.

In general in all buffers, the important keybindings are: c for catch up current item, n and p for next or previous unread articles N and P for actually next and previous article, m for create new message, a for creating new post, r for reply without cite, R for reply with cite, t for toggle some mode.

3.1 Server buffer

From group buffer, type ^ to enter server buffer. Use <space> (NOT <enter>!) to browse the groups of it, and subscribe via u. To unsubscribe, type u again. Actually after unsubscribe, the group still shows up in the group buffer, with U mark. To really remove it, use C-k (gnus-group-kill-group) on it in the group buffer. Oh, just noticed this is just kill-line command, so you can yank it back via C-y (gnus-group-yank-group). Likewise, kill a region also works as expect.

3.2 Group Buffer:

Finding the groups

  • gnus-group-browse-foreign-server (B): use nntp as back-end and news.gmane.org as address.
  • gnus-group-list-active (A A): List all groups that are available from the server(s).
  • gnus-group-unsubscribe-current-group (u): toggle subscription of the group
  • gnus-group-list-groups (l): list only subscribed ones with unread articles
  • gnus-group-list-all-groups (L): show all subscribed groups
  • gnus-group-make-rss-group (G R): paste the rss feed url to add RSS feeds
  • gnus-group-jump-to-group (j): jump to a group by entering name, this works for non-listing groups.
  • gnus-group-make-rss-group (G R): prompt to enter the RSS url. It is the link of the rss page of a blog, e.g. https://danluu.com/atom.xml

Management

  • gnus-group-catchup-current (c): mark all unread articles in the group under cursor as read
  • gnus-group-catchup-current-all (C): mark all unread articles in the group under cursor as read
  • gnus-group-mail (m): create a new message
  • gnus-group-post-news (a): create a new post
  • gnus-group-enter-server-mode (^): enter server buffer

Since we like organizing, there's a topic mode, enabled by t. After that, you will have a bunch of command prefixed with T. Topic mode group subscriptions into categories.

  • gnus-topic-mode (t): toggle topic minor mode.
  • gnus-topic-create-topic (T n): create a new topic
  • gnus-topic-indent (<TAB>): indent current topic
  • gnus-topic-unindent (M-<TAB>): unindent
  • gnus-topic-delete (T <Del>): delete topic under cursor

You generally just kill (C-k) and yank (C-y) to organize the groups into specific topics. UPDATE: Don't use C-k C-y, it seems to cause bug, that cannot save the configuration. Use the following instead.

  • gnus-topic-move-group (T m): move the group under cursor to a topic

When topic mode is enabled, <enter> and <space> on a topic line will fold or unfold it. So you don't really need the following commands.

  • gnus-topic-hide-topic (T h):
  • gnus-topic-show-topic (T s):

Groups can be combined into virtual groups. This is very helpful for reading emails. For gmail, the inbox will not show my interactions, that is in Sent Mail. So on Group buffer, create a virtual group by gnus-group-make-empty-virtual (G V) and edit it via gnus-group-edit-group-method (M-e) with regular expression like this:

(nnvirtual "nnimap\\+cymail:INBOX\\|nnimap\\+cymail:.*/Sent Mail")

3.3 Summary and Article buffer

This will list all the mails. <RET> to enter a specific mail. The following commands work in both buffers.

  • gnus-summary-next-unread-article (n): next unread article
  • gnus-summary-prev-unread-article (p): previous unread article
  • gnus-summary-next-article (N): next article
  • gnus-summary-prev-article (P): previous article
  • gnus-summary-next-page (<SPC>): scroll down, move to next unread article when at bottom
  • gnus-summary-prev-page (<DEL> or <BACKSPACE>): scroll up, but will not move article
  • gnus-summary-expand-window (=): this expand the summary buffer, very handy (instead of switch to summary and C-x 1).

Replying

  • gnus-summary-followup-with-original (F): follow-up to group and cite the article
  • gnus-summary-followup (f): follow-up to group without citing the article
  • gnus-summary-reply-with-original (R): reply by mail and cite the article
  • gnus-summary-reply-with-original (r): reply by mail without cite the article
  • message-forward-show-mml (C-c C-f): forward to another person
  • gnus-summary-mail-other-window (m): new mail
  • gnus-summary-post-news (a): new post

Management

  • gnus-summary-catchup-and-exit (c): catchup ALL in the buffer
  • gnus-summary-toggle-header (t): toggle all headers (a lot of MIME information)
  • gnus-summary-insert-old-articles (/ o): show all read articles
  • gnus-summary-rescore (V R): recompute the score. Score is computed by emacs rules. This can be explicitly set, or affected by some operations. For example, when you mark an article as read while didn't really read it, the related ones are marked like this.
  • gnus-sticky-article (A S): normally the article and summary buffer is reused, that means you cannot put two mails side-by-side. This command make the current article buffer un-reusable for doing that.

Threading

  • gnus-summary-toggle-threads (T T): toggle threading (flat style or thread style)
  • gnus-summary-refer-thread (A T): display the full thread
  • gnus-summary-refer-parent-article (^): fetch parent article
  • gnus-summary-top-thread (T o): go to the top of this thread
  • gnus-summary-kill-thread (T k): mark whole thread as read

Scores are computed for each article, for the sake of making important ones stand out.

  • gnus-summary-lower-score (L): create low score
  • gnus-summary-increase-score (I): create high score

Article will have marks to indicate the status of them. The followings are read marks:

  • r: marked as read by d command
  • R: actually been read
  • O: stands for old, marked as read in previous session
  • Y: having a too low score
  • C: marked as catchup

Other marks:

  • !: tick, i.e. important, and will always show
  • ?: dormant for now. This will show up whenever there are follow-ups.
  • A: this article has been replied or followed-up by me. gnus-replied-mark, this variable has a default value of 65, the ASCII for "A".
  • F: this article has been forwarded
  • *: this article is stored in cache
  • S: this article is saved
  • #: the process mark. This is similar to m in dired: you select some articles, and process them at the same time, using some commands.
  • .: gnus-unseen-mark, this article hasn't been seen before by the user. What does this mean??

The following commands interact with marks

  • gnus-summary-clear-mark-forward (M c): clear mark
  • gnus-summary-mark-as-read-forward (d): mark as read.
  • gnus-summary-tick-article-forward (!): mark as important.
  • gnus-summary-mark-as-dormant (?): mark as dormant.
  • gnus-summary-set-bookmark (M b): set a bookmark in the current article. This seems to be a position inside a long article. Gnus will jump to this bookmark the next time it encounters the article.
  • gnus-summary-remove-bookmark (M B): remove the bookmark from current article.
  • gnus-summary-mark-as-processable (#): mark the current article the process mark
  • gnus-summary-unmark-as-processable (M-#): remove the process mark

3.4 Message buffer

This is pretty standard: C-c C-c for send, C-c C-k for kill. What is not standard though is C-c C-d for draft, C-c C-m f to attach file.

During editing a message, you can just save it normally, and it will be in the draft group. The next time you enter draft, type D e (gnus-draft-edit-message) in draft summary buffer, you will resume to editing. Rejected articles will also be in draft group.

There are some commands for jumping around the buffer, and edit the headers.

4 Scoring

To mark a score for an article:

  1. how: I for increase or L for lower.
  2. what:
    • a for author
    • s for subject line
  3. match type:
    • e exact match
    • f fuzzy
  4. expiring
    • t: temporary
    • p: permanent
    • i: immediate, i.e. in effect right now, before even save the file

So what I want is actually I a f p. The scoring file is stored by default at ~/News/<group-name>.SCORE.