Inessential Gnus

The Student Information Processing Board

David Maze August 23, 1999

1 Introduction

Gnus is a news- and mail-reader for Emacs. It can be used to read Usenet newsgroups from either a local news spool or via NNTP, the Network News Transport Protocol; it also reads electronic mail through the MH system used on Athena or by reading the system’s local mailbox. Gnus provides facilities for sorting mail into several different groups, and it can assign scores to articles on the basis of articles you have read or not read in the past.

Gnus runs under your favorite version of Emacs. GNU Emacs is installed by default on Athena systems; XEmacs is available in the xemacs locker. You should already have some familiarity with the Emacs environment, and be at least vaguely familiar with Emacs-Lisp programming before starting to use Gnus. Note that some documentation on Emacs-Lisp is provided in Section 5.1 of this document.

2 Getting Started

Figure 1: The Gnus group buffer To start Gnus, type “M-x gnus” from within Emacs, or type “emacs -f gnus” from your Athena shell prompt. After getting some information from the default Usenet server (news.mit.edu, SIPB’s news server), you will be dropped into the *Group* buffer, which lists all of the groups to which you are currently subscribed. If you have used another news reader such as tin or slrn, Gnus will read your .newsrc file for subscription information; otherwise, you will be subscribed to a default set of groups.

From here, you can read a group by moving the cursor to its line and pressing “RET”. This will send you to a *Summary* buffer for the group. Each line represents a single message in the group. You can read a message by pressing “RET”, which will cause an *Article* buffer to appear. “C-k” will “kill” articles you don’t want to read. Other operations that can be performed in the group buffer, including subscribing to new groups, are described in Section 3, “Reading News and Mail”, below.

Each line in the summary buffer contains several key pieces of information:

• A single-character status, which can be blank (article is unread), “R” (article has been read), or “K” (article has been killed), among other possible values.

• A tick mark, “!” if the article is ticked. Ticked articles always appear in the summary buffer, and a group containing only ticked articles gets a special mark in the group buffer.

• The number of lines in the message.

• The author of the message. If the author provided a name, this is displayed; otherwise their electronic mail address is printed.

• The subject of the message.

Figure 2: The Gnus summary buffer From the summary buffer, you can press “q” to return to the group buffer. Pressing “q” in the group buffer will leave Gnus.

2.1 The Gnus Manual

Gnus has an extensive manual which covers all aspects of Gnus configuration and use. From anywhere within Gnus, you can press “C-c TAB” to view a relevant page in the manual. You can also press “C-h i” from anywhere within Emacs to get to the top-level page of the GNU Info system; press “TAB” until the cursor is over a line reading * Gnus: (gnus), and press “RET” to see the Gnus manual. Pressing “C-h m” from within Info will tell you more about its features.

3 Reading News and Mail

Gnus provides a mechanism for any data that “looks like a newsgroup” to be viewed. This can be a genuine Usenet newsgroup, a standard Unix mailbox file, an RMAIL file, or an MH mail folder, among other possibilities. Gnus’ default backend is nntp, which talks to a Usenet news server. This document will cover the more useful backends for the Athena environment; full documentation for the various Gnus backends can be found in the Gnus manual.

Groups can be added and deleted in the *Group* buffer. For a group in the default backend, pressing “U” will subscribe or unsubscribe you from that group, given its name. “u” will subscribe or unsubscribe for the group on the current line. Pressing “G m” will prompt you for a group name, a backend (“method”), and a server name, if appropriate to the backend, and create that group. The group will appear in the group buffer as backend+server:group, e.g. nntp+news.lcs.mit.edu:mail.ding for LCS’ archive of the Gnus development list. “C-k” will cause a group to permanently disappear; “u” will unsubscribe from a group, though it can be later resubscribed to. You can list all subscribed and unsubscribed groups with “L”, while “l” returns the display to just the subscribed groups.

3.1 Reading News via NNTP

The Network News Transport Protocol, or NNTP, allows computers to read Usenet news without maintaining a news spool themselves. NNTP is Gnus’ default backend, using news.mit.edu as its server. Pressing “B” will allow you to browse the groups available through a particular backend; providing “nntp” as the backend name and the name of a news server will allow you to explore an arbitrary server. Again, pressing “q” will return you to the group buffer. If you know the server name and group name, you can subscribe to a newsgroup from the group buffer with “G m”.

3.2 Reading Mail With MH

The MH mail system is used on Athena via the familiar “inc”, “show”, “rmm”, etc. commands. Gnus supports this through its nnmh backend. You can use the “G m” command to add an MH folder to your group buffer; use the name of the MH folder as the group name and “nnmh” as the method. You will not be prompted for a server address. “G DEL” will “delete” a group from Gnus’ point of view, but it will not delete the mail folder in your account; use the MH “rmf” command to do so. (Note that this command is intended to permantly delete a group; do not use it casually!)

You can enter an MH group the same way you would an ordinary newsgroup, and recieve a listing of the messages in that group. From the summary buffer, you can use Gnus commands to manipulate the messages in the group. “B DEL” will delete a message, like the MH “rmm” command; “B m” will perform the equivalent of the MH “refile”. “B c” will place a copy of the current message in another group.

4 Sending and Posting

Gnus’ message mode is used to compose outgoing mail and news messages. If a given message has a “To:” header, it is sent as electronic mail; if it has a “Newsgroups:” header, it is posted to Usenet.

Figure 3: Sending a message in Gnus One begins composition of an outgoing mail message by pressing “m” from the group or summary buffer. This will place you in a new empty message buffer. Your .signature file, if you have one, will automatically be inserted. Fill in the headers above the line containing --text follows this line--, and the body of the message below it. Then press “C-c C-c” to actually send the message. If you want to abandon the message, press “C-c C-k” instead.

The “a” command posts an article to a group. If used from the group buffer, Gnus assumes you want to post a Usenet article and prompts you with an empty Newsgroups: line in the message buffer. From a summary buffer, the “a” command does its best to post a message to the current group; “C-u a” from the group buffer tries to post to the group on the current line. If the group is a news group, the message buffer holds a Newsgroups: line containing the name of the group. If the group is a mail group, the message buffer has an empty To: line instead.

Gnus has both the concepts of “replying” to a message by sending mail to its author and of “following up” in the same forum the original sender posted to. From the summary buffer, “r” will create a new empty message addressed to the author of the current message, like the default action of the MH “repl” command. “f” will post a follow-up message to a newsgroup, if the current message was posted to Usenet. If it was a mail message, Gnus creates a new message addressed to the sender and every recipient of the original. The “R” and “F” commands do the same thing as their lowercase companions, except that they provide a cited copy of the original message in the body.

5 Customizing Gnus

Being an Emacs package, most Gnus customization is done in a variant of Lisp called Emacs-Lisp. A limited number of settings need to go in your .emacs file, but most options should instead be set in a .gnus file in your home directory. You can make Gnus re-read the .gnus file by pressing “r” in the group buffer.

5.1 The Least Emacs-Lisp You Need To Know

• Most things in Lisp are evaluated; you can prevent evaluation of an object by preceding it with a single quote, or “quoting” it.

• Lisp commands occur inside balanced parenthesized blocks. A quoted parenthesized block becomes a list. So (gnus) is a Lisp command that starts Gnus, but '(gnus) creates a list containing only the symbol 'gnus.

• The setq command sets the value of a variable. The syntax is (setq variable value). variable is not evaluated, but value is; quote the value to prevent evaluation.

• t and nil are Lisp’s boolean values for “true” and “false”, respectively.

• A hook is a series of commands run at a specified time. A function can be added to a hook with the add-hook command; the syntax is (add-hook hook function), which adds function to hook. Both parameters are evaluated; if you use function names here, be sure to quote them.

• A comment begins with a semicolon and continues to the end of the line.

For more information on a particular function, type “C-h f” followed by the function name; “C-h v” will give information on a particular variable.

5.2 Topics

Gnus allows you to divide groups in the group buffer into a number of separate topics, if you choose. You can toggle this behavior by pressing “t” from the group buffer, and enable it permanently by

adding (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) to your .gnus file. Basic topic

commands are listed in the “Topics” menu. These include:

T n Create a new topic
T r Rename the current topic
T D Delete the current topic
T m Move the current group to a different topic
T c Copy the current group to a different topic

5.3 Adaptive Scoring

Gnus can automatically assign scores to articles you read in mail and news groups. Authors, subject lines, and possibly even words within subject lines recieve higher scores if you read articles containing keywords, and lower scores if you kill off articles instead.

You can enable adaptive scoring by adding (setq gnus-use-adaptive-scoring t) to your .gnus file. Once you do this, some articles in the summary buffer may have “+” or “–” marks next to them; these articles have positive and negative scores, respectively. Gnus’ default behavior is to mark articles with negative scores as “read” automatically.

You can further control scoring by creating score files in the News directory in your home directory. A file named all.SCORE affects every group; a file named groupname.SCORE only affects the group groupname. Note that score files affect groups even if adaptive scoring is not being used. Score files look like Lisp files, but the entire file is inside a single pair of parentheses, no evaluation is done, and no quoting is necessary. Your score files should probably include (read-only t), which prevents Gnus from overwriting the file. It is useful to put (mark n) and (mark-and-expunge n) in your default score file. The former controls at what score articles get marked as read, and the latter controls how low a score an article can get before you never see it at all.

From the summary buffer, you can see why an article has the score it does by pressing “V T”. Score files and scoring are covered in more detail in the Gnus manual. A sample score file is also in the manual.

5.4 Expiry

Gnus can automatically delete specified messages after a specified amount of time. Individual messages can be marked to expire, or you can specify that all messages in a group should automatically expire.

Unless you specify total expiry for a group (see below), Gnus will never delete an article unless the user explicitly requests it (with “B DEL”) or the article is marked as expirable. You can manually mark an article as expirable by pressing “E” from the summary buffer. You can remove the expirable mark by replacing it with another mark; pressing “d” will replace the mark with a “read” mark.

You can specify either automatic or total expiry on specific groups to have articles automatically expire. This is often useful for mailing lists that are archived either on the Web or through a system such as Discuss. With automatic expiry, articles are marked expirable when you read them; you can change the mark if you wish. If a group is marked for total expiry, every article that is not unread or ticket is presumed to be expirable. The Gnus manual notes that automatic expiry and adaptive scoring interact poorly.

A group’s parameters indicate whether a group is automatic or total expirable, or neither. You can edit the group parameters by pressing “G p” from the group buffer. This brings up a buffer that is either a list of group parameters or nil. You should change this to a list containing the symbol auto-expire or total-expire, as appropriate. Then press “C-c C-c” to save the group parameters and exit the buffer.

The default expiry wait is one week. You can change this globally by setting the nnmail-expiry-wait variable; try putting (setq nnmail-expiry-wait 14) in your .gnus file to change the wait to two weeks. You can also change the expiry wait on a per-group basis by adding an “expiry-wait” parameter. To have a group with total expiry and an expiry wait of 10 days, you could change the group parameters to

(total-expire
 (expiry-wait . 10))

5.5 Sorting Mail

Gnus can automagically sort your mail into different folders on the basis of text appearing in message headers. The Gnus term for this is “splitting” incoming mail, and it’s controlled by the nnmail-split-methods variable. This variable is a list of lists, each of which contains the name of a mail group and a regular expression. If the regular expression matches anything in a given message header, the message is put into that group. An empty regular expression matches anything, and you should probably have a rule that sorts otherwise unmatched mail into some group (if you don’t, it’s gone forever).

Code in my .gnus file might look like this:

(setq nnmail-split-methods
  '(("reuse" "reuse@mit.edu")
    ("sipb" "sipb-.*@mit.edu")
    ("course6" "@altoids.mit.edu")
    ("course6" "@robert-a-heinlein.mit.edu")
    ("personal" "dmaze@mit.edu")
    ("other" "")))

Note that it is possible to have multiple lines point to the same mail group. It is also generally useful to sort out mail specifically addressed to oneself, and have a separate group for otherwise unmatched mailing lists, blind carbon copies, and spam.

By default, Gnus will send an article to every matching group. You can set nnmail-crosspost to nil to cause Gnus to only send an article to the first matching group.

Gnus will sort all incoming mail according to nnmail-split-methods, both when you start Gnus and when you check for new mail using the “g” key from the group buffer. Groups that do not exist will be created, but may not be visible immediately. Additionally, from the summary buffer, pressing “B r” will “respool” a message, removing it from the current group and placing it wherever it would go according to nnmail-split-methods. “B q” displays the group or groups the current message would go to if respooled, but does not actually move the message.

6 Gnus and XEmacs

If you use XEmacs (located in the xemacs locker on Athena), Gnus has some useful features that make it easier to make Gnus do what you want.

6.1 Gnus Upgrade

XEmacs comes bundled with Gnus 5.5, a newer version of Gnus than is bundled with GNU Emacs. Some features are enhanced in the newer version of Gnus.

6.1.1 Scoring

By default, Gnus only performs scoring on entire subject lines. You can customize this by changing the gnus-use-adaptive-scoring variable. In addition to t or nil, it can also be set to a list containing one or both of 'line and 'word. The first asks Gnus to score adaptively on entire subject lines, the second on individual words in subject lines. To enable both, place (setq

gnus-use-adaptive-scoring '(line word)) in your .gnus file.

You can examine per-word scoring in a group using “V w” from the summary buffer.

6.2 Pretty Pictures

The Gnus logo is displayed as a bitmap when you first start Gnus, rather than as a nearly incomprehensible set of underscores.

6.3 Customizing Group Parameters

Figure 4: A group Customize buffer in XEmacs Gnus can use Emacs’ customization facilities, included in the XEmacs distribution, to provide a way to change what happens in a given group without using Lisp. From the group buffer, “G c” will bring up a *Gnus Customize* buffer for the group the cursor is at. Useful parameters include:

• To Address, specifies the address (generally of a mailing list) that followups and posts should go to. Following up to mail in a group with this parameter sent sends mail only to this address, not to any other recipients (they are presumed to be subscribed to the list).

• Broken Reply To allows you to deal more intelligently with mailing lists that assume broken mail programs. Even if a “Reply-To:” header is provided in the message, Gnus uses its normal mechanism for determining the destination of a reply or follow-up if this option is set.

• Automatic Expire, Total Expire, and Expire Wait control how articles may be automatically removed from a group. See “Expiry” above.

• Display controls which articles are displayed when you enter the group. The “default” setting only displays unread and ticked articles. You can change this setting to “all”, which will display every message in the group whenever you enter it.

• Admin Address and Comment both contain information that may be useful to the user, but are not used by Gnus. The first contains the address for administrative requests about a mailing list, generally “listname-request”. The second contains an arbitrary comment.

6.4 Features Requiring More Effort

• MIME support with TM. The Tools for MIME package include with XEmacs can display MIME-encoded messages in the Gnus article buffer. Add (setq gnus-use-tm t) (load "gnus-setup") to your .emacs file. Plain-text and graphical attachments will be displayed in the article buffer, and any part of a MIME message can be saved to disk or viewed externally. See the TM manual in Emacs Info (“C-h C-i tm”) for more information.

• The Insiduous Big Brother Database. The Insiduous Big Brother Database (“BBDB”) is an address book that can keep track of people who send you mail, if you choose. Adding the following fragment to your .emacs file should get you started:

(require 'bbdb)
(bbdb-initialize 'gnus 'message)

You can use the “:” command from the summary buffer to have the BBDB notice the author of the current post. A small window showing things you know about the author of the message will appear below the article buffer. Additionally, when composing a message, “M-TAB” will try to complete an address based on BBDB information. More information can be found in the BBDB manual; press “C-h C-i bbdb”.

• Picons. Gnus can display small graphical icons for newsgroups and authors. Put (setq gnus-use-picons t) in your .gnus file to enable picons. Note that you also need someplace to get the actual picons from. One convenient source is the piconsearch service, which you can

     use by adding (setq gnus-piconsearch-url "http://www.cs.indiana.edu:800/piconsearch")

to .gnus. By default, picons display in their own Emacs buffer, but you can display them in

     the article buffer by adding (setq gnus-picons-display-where 'article) to .gnus.

• X-Faces. Some newsgroup posters include an X-Face: header in their posts, which includes a 48x48 bitmap somehow representing them. You can automatically display X-Faces by adding

     (add-hook 'gnus-article-display-hook 'gnus-article-display-x-face) to .gnus.

Appendix 1 Gnus and MH

Anything you can do from the command line in MH, you can do in Gnus. This table contains the equivalent commands:

MH Command Gnus Buffer Command Description

inc Group g Gets new mail from POP server; scans for new

news messages.

scan  Group  RET  Lists the messages in a group.
show  Summary  RET  Displays an article.
next  Summary  N  Displays the next article.
prev  Summary  P  Displays the previous article.
rmm  Summary  B DEL  Deletes the current message.
repl  Summary  r  Replies to the author of the current message.
comp  Any  m  Composes a new message.
forw  Summary  C-c C-f Forwards the current message to a new recip-

ient.

The summary buffer’s “N” and “P” commands behave nearly identically to MH’s “next” and “prev”; “n” and “p” display the next and previous unread messages, respectively. “R” replies to the author of the current message, citing the original; “f” and F send a follow-up to everywhere the current message went. “a” composes a new news message from the group buffer or from a news group, and composes a new mail message in mail groups.

Appendix 2 Gnus Versions

Gnus goes through three different stages in its development cycle. Named versions of Gnus are alpha versions. Versions with an even minor number are beta versions, but are generally stable enough to use. Versions with an odd minor number are stable, released versions. Only versions with an odd minor number are included with Emacs distributions.

The first version of the modern incarnation of Gnus was called (ding) Gnus; this evolved into Gnus 5.0 and 5.1. September Gnus preceded Gnus 5.2 and 5.3; Gnus 5.3 is included with Emacs 19.34, the default version of Emacs on Athena. Red Gnus was the development version of Gnus 5.4 and 5.5; Gnus 5.5 is included with XEmacs 20.4, in the xemacs locker. Quassia Gnus added some offline reading support, and was released as Gnus 5.6 and 5.7. Pterodactyl Gnus is, as of this writing, still under development; when released as Gnus 5.8, it will have built-in MIME reading and composition support.

Appendix 3 For More Information

More information on Gnus can be found in the Gnus manual and in the Message manual; type “C-h C-i”, and then either “gnus” or “message” to view the respective manuals in Emacs Info. The Gnus home page is on the World Wide Web at http://www.gnus.org/. For help with Gnus questions, you can ask the Usenet gnu.emacs.gnus group. Gnus development is discussed on the ding mailing list, mirrored at nntp+news.lcs.mit.edu:mail.ding.