Since I got into web feeds recently, I am continuously tweeking on my feed reading experience. I like the elfeed feed aggregator package for the Emacs editor/lisp-machine and provides a wonderfully hackable experience.

Recently, Tassilo Horn (@tsdh) mentioned me in his blog post “Make your RSS enjoyable in feed readers such as elfeed”, where he explains how to configure elfeed to open feeds in EWW (the Emacs Web Browser) with a prefix-arg (C-u) to the elfeed-search-browse-url and elfeed-show-visit commands. This is useful when a feed entry only shows a preview, instead of a full blog post or news article.

After reading that and adapting my own configuration, I asked myself: Since I know which feed URLs only show previews, why not save some button presses and automatically open certain feeds in EWW? For configuring which feeds to open in EWW, I decided to leverage the built-in tag-system (I mostly set tags via elfeed-org) to decide which feeds to open in EWW instead of storing those feeds in a separate list. In my case, I decided to use the browse tag. Here is the code that I came up with:

(defun meliache/elfeed-show-eww-if-tag (entry tag)
  "Browse elfeed ENTRY in eww if it is tagged with TAG."
  (when (member tag (elfeed-entry-tags entry))
    (let ((browse-url-browser-function #'eww-browse-url))
      (elfeed-show-visit))))

(defun meliache/elfeed-show-eww-if-tag-is-browse (entry)
  "Browse elfeed ENTRY in eww if it has the tag `browse'."
  (meliache/elfeed-show-eww-if-tag entry 'browse))

(advice-add #'elfeed-show-entry :after #'meliache/elfeed-show-eww-if-tag-is-browse)

I temporarily overwrite browse-url-browser-function with EWW as the main browser for elfeed-show-visit to open the URL in EWW independent of any other1 browser configuration.

I considered writing meliache/elfeed-show-eww-if-tag more generically to accept an arbitrary number of tags (via a &rest tags parameter), but better keep the complexity here low and anyway, elfeed has good functionalities for automatically tagging entries.

In the end, I implemented my function as an advice after the elfeed-show-entry function, even though I prefer using emacs hooks if possible. There is a elfeed-show-mode-hook, but it called before the buffer-local variable elfeed-show-entry is set, thus I don’t have access to the feed entry properties. As an after advice, the elfeed-show-entry function is still called and thus the eww buffer is displayed nicely in the side window that I get from elfeed-goodies:

The downside is that if I quit the buffer eww buffer with q, I still have to quit the elfeed-show buffer as well with another q press, which can be a mild annoyance. Probably guess it should be possible to completely replace elfeed-show-entry with my own function that prepares the buffer same as the former and then calls EWW.

So far, I only added the browse tag to the APOD feed (Astronomy Picture of the Day), which only shows a miniscule thumbnail of the daily picture which is barely recognizable without opening the website. And as can be seen above, EWW offers a nice viewing experience for that purpose. However, for many news feeds, I want to read the summary before deciding whether reading the whole article is worth it. In addition to that, the EWW experience is often suboptimal, I often have to scroll through several pages of header links until I get to the actual post. I think I will mostly add the browse tag to those horrible feeds where the feed contents are empty or offer no additional information over the feed headline (e.g. the Nature briefing feed).


  1. : After implementing tsdh’s suggestions to have EWW be the secondary browser and open links in that when a prefix-argument is used, my first implementation just called elfeed-show-visit with a prefix argument programmatically, but this might not work for others. ↩︎