Sams Teach Yourself Emacs in 24 Hours


Hour 21: Advanced Gnus

Previous HourNext Hour

Sections in this Hour:



When subscribed to high-volume newsgroups or mailing lists, you will quickly find that your days simply are too short to read through all the messages. What you need is a slave who can read all the messages and then show you the most interesting messages. You might argue here that it is very difficult to get good slaves nowadays, but you are wrong! The slaves nowadays are called computers! People often tend to forget that.

Using the scoring system in Gnus, you can tell your slave to find the messages that are of special interest to you. This is done by telling Gnus to score each messages based on a set of rules, and then show you only the messages above a given score, or asking it to sort the messages based on their score.

The score rules can be arbitrarily complex, but the simple ones discussed in this hour will do in most cases. The simple rules include the following:

Scoring the Messages

You configure your scoring from the summary buffer. To add a score, select Increase Score from the Score menu. To lower the score, select Lower Score from the Score menu. The scoring is done based on the current message.

By default, 1000 points are added or subtracted by these commands, but you can change that by pressing Escape, typing the number, and then selecting the commands from the Score menu.

When you have selected a score function, Gnus asks you what part of the message you want to score on. The idea is that the current message should be a template for scoring other messages. The question is What part of the current message should be used as the template? The author? The subject? Messages from the thread?

To this question, you can answer one of the following things (press ? to show you which key to press to get a given match):

More ways to match text exist. For a complete list, please see the Gnus reference manual.

When you tell Gnus which part to match, it asks you how to match it. For the date match type it suggests before, on the same day , and after. All the others described previously are matched as strings, and the following matching patterns exist:

Finally Gnus will ask you which type of scoring this should be. You have two choices:

When you have scored an message, the scoring takes effect when you enter the Summary buffer next time. If this is not good enough for you, you can select Rescore Buffer from the Score menu, and press C-M-t twice (which disables and then again enables threading, or the other way around if threading is not enabled).

Scoring Using BBDB

It can be very useful to let BBDB help you score persons. This is done by adding the following to your .Gnus file:

(setq bbdb/gnus-score-default 2000) 
(setq gnus-score-find-score-files-function '(gnus-score-find-bnews.span class=compcode>bbdb/gnus-score)) 

2000 is the default value which is added to a message's score if the message is from a person in the BBDB database.

For each person in the database, you can also specify the score separately. This is done by adding a field called gnus-score (see the section "Inserting Entries into BBDB").

Using the Score Information

Now that you have scored your messages, it would be nice to use this information, right? There are a number of things you can do:

(setq gnus-thread-sort-functions

Scoring Individual Groups

Normally the score information is kept separate for each group you are subscribed to. That is, when you score on an author in one group, then this author's score is not affected in the other groups.

You can, however, tell Gnus to add scores to the file all.SCORE. This score then affects all groups. This is done by selecting the item Switch Current Score File from the Score menu and typing all.SCORE when Emacs asks for a filename. (You should be able to make a macro that does this.)

By pressing M-i a I or M-i a L you raise or lower the score, respectively, in the global file instead of the score file local for the group.

These keybindings might not be that easy to remember, so if you insert the following into your .Gnus file, then you can press C-S-i or C-S-l instead to raise or lower the score in the global kill file.


Sams Teach Yourself Emacs in 24 Hours


Hour 21: Advanced Gnus

Previous HourNext Hour

Sections in this Hour: