Scoring news and email in Gnus


Categories: Emacs Gnus Tags: Emacs Gnus

Executive summary

Gnus, the newsreader for Emacs, can assign arbitrary scores to articles that it downloads. The scores can be used to define a user-generated, understandable AI recommendation engine1, which sorts and filters news on behalf of the reader. In this article, I describe the simple method that I use to define the filtration algorithm of my news.


I’ve previously written about both Gnus and recommendation engines, so it makes sense to write about the intersection now. You may have had the experience reading webfeeds where some of the articles are more important and less important than others, and perhaps wanted a way to act on those preferences. In Newsblur, Feedly, etc, you are just stuck with downloading all the news and showing it in chronological order. In Emacs, we get to have our cake and eat it too, as usual. Luckily, Gnus lets you store all these articles preferences in the form of scores. We can then use the scores to perform different articles action.


Let me give two concrete examples which basically cover the entirety of how I use scoring. One of the blogs that I read is the Slow Boring blog on substack. It’s a nice blog that often touches on local politics for me, but some of the articles I don’t care for. Every day, there is a posting about an open discussion thread. I’m not a substack guy, so I can’t view or comment in these threads, but they show up in the RSS. Using Gnus, I assign a low score to these kind of posts. Specifically, I assign a score of -1000 to any post with the words “mailbox”, “mailbag”, or “thread” in the title. This is a low enough score that they will automatically be grayed out, which means marked as read.

On Hacker News, I want to prioritize all the posts about Emacs. So everything that has the word “emacs” in the title gets an automatic +1000 to the score.

By default, every post in Gnus starts with a score of 0. Posts with a negative score are auto-read for me. You can even configure Gnus to auto-delete posts with a score under a certain threshold, but I’m not comfortable with this kind of thing. Posts with a large positive score can be auto-marked as important2

Settings scoring rules

You need to make sure you’ve got (setq gnus-use-scoring t) in your gnus.el, and you are ready to go. Take a look at the scoring section of the Gnus manual.. There are many scoring commands in the summary buffer, which can be accessed using the V keymap, or the Score item in the menu bar.

It’s important to know that scoring mostly will happen interactively, so you don’t need to learn the special score file syntax. Let me tell you my recipe for setting a score: I only use two commands: Issp and Lssp. Issp increments the score based on a keyword in the article title. Lssp decrements the score similarly. So, for example, on a hacker news post, in the summary buffer, I type Issp then “emacs”.

Sorting your news

By default, I use the following group sorting rules:

  (setq gnus-article-sort-functions '((not gnus-article-sort-by-number)
                                      (not gnus-article-sort-by-date)

The way you read this sorting is as follows: first: sort all the new articles by score, from high to low. Then for articles with the same score, sort those articles from newest to oldest. For me, this kind of sorting is basically always what I want to see.

And I make sure the article scores show up in the summary buffer, so that I know to tweak my rules if needed:

(setq gnus-summary-line-format "%U%R %-17,17&user-date;%(%[%-15,15f%]%)%[%i%] %B%s\n")

Now you know how to make your own news recommmendation engine in Emacs.

  1. Not really, but it is good marketing!↩︎

  2. In different mail readers this has different names. In Gnus and Apple Mail, this is called flagging. In Gmail it’s called Starred mail.↩︎