blog.lazkani.io/content/posts/yet-another-rss-reader-move.md

176 lines
7.5 KiB
Markdown

+++
title = "Yet Another RSS Reader Move ?"
author = ["Elia el Lazkani"]
date = 2020-09-14
lastmod = 2020-09-15
tags = ["emacs", "org-mode", "configuration"]
categories = ["rss"]
draft = false
+++
The more I get comfortable with _emacs_ and _doom_, the more I tend to move things to it. This means that I am getting things done faster, without the need to get bogged down in the weeds of things.
This also means that, sometimes, I get to decommission a service that I host for my own personal use. If I can do it with a _text file_ in _git_, why would I host a full-on service to do it for me ?
You might say, well, then you can access it from anywhere ! Security much ?!
if I don't have my machine, I will not access my passwords. In practice, the reality is that I am tied to my own machine. On one hand, I cannot access my services online without my machine and if I am on the move it is highly unlikely for me to access my _rss_.
Oh yeah ! _rss_ ! That's what we are here for right ? Let's dive in...
<!--more-->
## Introduction {#introduction}
I hosted an instance of _[miniflux](https://miniflux.app/)_ on a _vps_ for my _rss_. _Miniflux_ is a great project, I highly recommend it. I have used it for a number of years without any issues at all; hassle free. I love it !
But with time, we have to move on. I have had my eye on the _rss_ configuration in the _doom_ `init.el` since I installed it. Now comes the time for me to try it out.
I will go with my process with you so you can see what I did. There might be better ways of doing things than this, if you know how ping me !
## Doom documentation {#doom-documentation}
The nice thing about _doom_ is that it is documented. The `rss` is a _doom_ `module` so we will look in the _doom_ `modules` manual.
We can achieve this by hitting `SPC h d m` and then searching for `rss`. The documentation will give us a bit of informaton to get started, like for example that it uses `elfeed` as a package.
## Elfeed {#elfeed}
The creators of [elfeed](https://github.com/skeeto/elfeed) describe it as.
> ... an extensible web feed reader for Emacs, supporting both Atom and RSS.
The project looks well documented, that's very good. It has extensions, _org_ one... wait _org_ one ? What does it do ?
## Elfeed Org {#elfeed-org}
What is this thing [elfeed-org](https://github.com/remyhonig/elfeed-org) ?
> Configure the Elfeed RSS reader with an Orgmode file
Sweet ! That's what I'm talking about. A neatly written _org_ file as configuration.
It is always a good idea to go through documentation, at least quickly. Skim it over, you don't know what you would miss in there. I've been doing this for a long time, there is no way I can miss any... oh wait... I missed this...
### Import/Export OPML? {#import-export-opml}
Whaaaat ?
> Use `elfeed-org-import-opml` to import an OPML file to an elfeed-org structured tree.
Alright, that sounds easy. Let's export from _miniflux_ and import in _elfeed_.
## Configuration {#configuration}
Before we import and whatnot, let's figure out what we are importing and where.
After reading the documentation of both `elfeed` and `elfeed-org`, it says we need to set `rmh-elfeed-org-files` which is a _list_.
In my _doom_ configuration, I think I need to do the following.
```emacs-lisp
(after! elfeed
(elfeed-org)
(setq rmh-elfeed-org-files (list "~/path/to/elfeed.org")))
```
This way we can guarantee where the file is, or we can go digging where the default is and copy from there.
This is just another file in my _org_ collection. Nothing special about it, it gets tagged and searched like everything else.
<div class="admonition note">
<p class="admonition-title">Note</p>
I added the `(elfeed-org)` in the block to load `elfeed-org` after I had to load it manually a few times. This made it work on my system, I might be doing it wrong so your milage may vary.
The `after!` section is _doom_ specific.
</div>
I also added the following line above the `rmh-elfeed-org-files` line.
```emacs-lisp
(setq elfeed-search-filter "@1-month-ago")
```
I simply wanted to see a span of _a month_ instead of the default _2 weeks_.
The end result configuration is as follows.
```emacs-lisp
(after! elfeed
(elfeed-org)
(setq elfeed-search-filter "@1-month-ago")
(setq rmh-elfeed-org-files (list "~/path/to/elfeed.org")))
```
<div class="admonition warning">
<p class="admonition-title">warning</p>
This is the time where you _reload_ your configuration, _reload_ emacs and then _reload_ the world.
If you are not using _doom_, only `setq` lines and do not forget to manually load the _packages_ before callind them.
</div>
## Importing {#importing}
I think this is going to be a nightmare. It says on the page `M-x` then `elfeed-org-import-opml`, yeah right !
Alright let's do that. It prompts for the file, we give it the file and nothing happens...
Let's look in our `elfeed.org` file and whaaaa ! It's all here. That is awesome ! And here I was, the doubter, all along.
Now, let's move things around, tag them properly and categorize them as we please.
For all of you who are not _importing_, here's how mine, snippitized, looks like.
```org
* Elfeeds :elfeed:
** Bloggers :blog:
*** [[https://blog.lazkani.io/rss.xml][The DevOps Blog]] :personal:
** Websites
*** News :news:
**** General :general:
***** [[https://www.reddit.com/r/worldnews/.rss][Reddit: World News]] :world:reddit:
***** [[https://www.reddit.com/r/europe/.rss][Reddit: Europe News]] :europe:reddit:
**** Technology :technology:
***** [[https://www.reddit.com/r/technology/.rss][Reddit: Technology]] :reddit:
*** [[https://xkcd.com/rss.xml][xkcd]] :xkcd:
```
Granted, it is not much the looker in this mode but a picutre will reveal far better results, I presume. Don't you think ?
{{< figure src="/ox-hugo/01-elfeed-org-configuration.png" caption="Figure 1: Elfeed Org Configuration" target="_blank" link="/ox-hugo/01-elfeed-org-configuration.png" >}}
Oh yeah, now we're talking !
### Why the hierarchy ? {#why-the-hierarchy}
_Elfeed-org_ by default **inherits tagging** and **ignores text**. In this way, I can cascade _tags_ and when it's time to sort I can search for `+xkcd` and I get only _xkcd_ posts. I can also do something similar to filter on `+general +europe` for specifically getting _Europe_'s _Reddit news_.
The other reason for the _org_ integration is the documentation aspect for the future. I have only recently migrated to _elfeed_ so the documentation is still somewhat lacking, even for me. Not to worry though, as is the custom with the other migrations so far I ended up documenting a lot of it in better ways.
## The big finish ? {#the-big-finish}
Okay, okay ! That's a lot of babbling let's get to it, shall we ?
Now that everything is configured the way we like. Let's _reload_ everything and try `M-x` `elfeed`.
Yeah, I know not very impressive huh ? We didn't add any _hooks_ to update and fetch things. I like to do that manually. The documentation, though, describes how to do that, if you like. For now, let's do it ourselves `M-x` `elfeed-update`. You should be greeted with something like this.
{{< figure src="/ox-hugo/02-elfeed-search.png" caption="Figure 2: Elfeed Search Buffer" target="_blank" link="/ox-hugo/02-elfeed-search.png" >}}
Looks nice huh ?! Not bad at all.
## Conclusion {#conclusion}
There was nothing hard about the setup, whatsoever. It took me a bit to go through the relevant bits of the documentation for _my use cases_ which are, I admit, simple. I can now decommission my _miniflux_ instance as I have already found my future _rss_ reader.