Sams Teach Yourself Emacs in 24 Hours
Hour 21: Advanced Gnus
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:
Whenever Lars Ingebrigtsen says something, then I'd better listen, so score all his messages high.
There is this very irritating person who asks stupid and rude questions all the time, so give his messages a negative score. A negative score means that I'm less interested in his messages than messages that haven't gotten a score at all.
I just love hearing about scoring on the Gnus mailing list, so add a positive score to all messages with the word score in their subject.
This thread is interesting (or boring), so score all messages in this thread with a positive (or negative) score.
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):
Match the From field (press a)--This changes the score on all messages from the author of the given message.
Match the Subject field (press s)--This changes the score on all messages with the same subject. Later, you will see that you can change this statement to all messages with approximately the same subject.
Match the date of the message (press d)--This changes the score of all messages sent on the same day as the current one, all messages sent before the current one, or all messages sent after the current one. (Gnus asks you whichever it is.)
Match followup to messages from a given person (press f)--Using this match type you can tell Gnus to change the score for all messages that are responses to a message from the author of the current message. You can, for example, use this to increase the score of all responses to messages sent by you.
Match subbranches of the thread rooted at the given message (press t)--If you see an interesting message or a thread that is lengthy and not of interest to you, then you can use this scoring method to change the score of all messages that stem from the current message.
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:
Exact string match--When a message is matched against your formula, then it matches only if the string from the message matches exactly. For example, if you have said that you want to increase the score when a message is from "Jesper Pedersen <firstname.lastname@example.org", then this will not match "Jesper Pedersen <email@example.com", due to the changed domain.
Substring match--Using substring matches, you can specify a string that should be part of the string to match. This way you can, for example, score on the string .edu depending on how much you like mail from universities.
Regular expression match--With this match type you are allowed to type in a regular expression that should match.
Fuzzy matching--From the reference manual: "It's so fuzzy that there's not even a definition of what fuzziness means." This matching type matches the two strings, after it has removed noise. Noise is defined as extra spaces, parenthetical remarks, and so on.
Finally Gnus will ask you which type of scoring this should be. You have two choices:
Permanent scoring--This means that the score exists forever (in contrast to temporary scoring ). This is used to score people you know as being competent. This could, for example, be Lars Magne Ingebrigtsen, the maintainer of Gnus, or Richard Stallman, the author of Emacs.
Temporary scoring--To avoid the tables with scoring information growing huge, you may specify that a scoring is to be regarded as temporary. This means that if it hasn't been used for a week, it will be deleted. This might be a good idea when scoring on a thread, for example.
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).
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").
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:
You can make Gnus show the score in the Summary buffer, as can be seen in Figures 21.7 and 21.8. By default only a plus is shown if the message's score is above zero and a minus if the score is below zero.
By default all messages that have a negative score are marked as read.
You can tell Gnus to sort your messages with respect to the score, as you saw in the previous section. If you want to do that by default, insert the following into your .Gnus file:
(setq gnus-thread-sort-functions '(gnus-thread-sort-by-number gnus-thread-sort-by-total-score))
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
© Copyright Macmillan USA. All rights reserved.