The Joys of Hacking: Making an Emacs org-mode rss reader

I've got a confession to make. Despite using FOSS software since I was 16 (I am almost 25) I have never truly modified any source code for my own use. I've played with some config files, and some Suckless config headers but other than that I have pretty much just used things as is. I thought "Man I don't get any of this stuff, these guys must be god-tier programmers" or "This is way overcomplicated, surely this could be easier" and was generally blaming my lack of programming knowledge. Until now that is.

Since migrating to emacs from vim in November 2020 I've been trying to replace all my terminal programs with Emacs equivalents. Mainly because I configured everything to be vim like anyways and since I value a consistent interface I figured Emacs would be great for it. Since then I've been plugging away customizing my own emacs since dropping Doom Emacs and making it a little bit better each day.

With the exception of rss everything has been great. I didn't like the rss offers in Emacs. Elfeed I couldn't get tags to work and I didn't like the layout, I much prefer Newsboat style Authors and then posts by only that author. Newsticker was fine and I used it for a little while, but I couldn't really transfer it between my desktop and my laptop for couch browsing. So I set out to make my own system using Emacs and Org-mode because I love the formatting

Now where does hacking come into this? Well I discovered that xml parsing is hard. Even harder when you're taking it on using a programming style you are unfamiliar with, in my case functional programming and lisps in general. I tried a ton of stuff with the help of the kind people in #emacs but couldn't get anything to stick. Until I discovered sfeed.

Sfeed is a suckless rss reader, with a ton of export options. HTML being one of them. I liked the HTML output, so I went about looking to see if I could possibly convert this .html to a .org. I came across Pandoc and while it worked ok, it wouldn't give me the links to the items in my feed just a list of them. After searching endlessly for a way to get pandoc to preserve the links, I gave up. Then I turned my head to learning the sfeed html export.

I started by copying sfeed_html.c and then reading it once, and playing with it by inserting random things into the output to see where they landed so to speak. After figuring the basics out I modified it to print different things with different header levels (which is a varying number of * in org-mode) and then voila I had my basics down

Which was great, however I didn't know how many new items I had, nor did I know how which posts where new! So I set out to figure out how to tag them. I eventually settled on adding [NEW] before the item date like so

Well that was one issue taken care of.. except hey wait why the hell are all the apostrophes this "& # 36;" stuff? Well without the spaces it turns out that is the html encode for apostrophes! Which I then found out sfeed was encoding with a function xmlencode(). The rest of the program usually uses fputs() function, which writes a string. I replaced the xmlencodes with fputs and hey it works, no more weird apostrophes!

Finally I discovered I wanted to see a list of who has updated only. With some tracking I found an element called sidebar, and replaced some of its code with a simple if statement alongside a struct pointer and I got a list of who has updated today.

So now everything looks how I want it to!I created a function to run a shell script to update my feed and to create the file I wanted.. but wait..I still want to open these to read them! No problem I'll just use org-open-at-point..wait that's great for opening things in a browser page but I want youtube to get piped into mpv so I don't have to go to the website and sign in.. that sucks

For the next day or two I would try all I could think of to get the link and just pipe it into mpv, then bind that to a key. I didn't even want a smarturl handler or anything. Luckily one of the people in #emacs found this package called play-media and it is setup for mpv out of the box! The Emacs community is great like that.

Finally a picture of the final product (with bonus Ross from Accursed Farms)

Now that I have confirmed with myself that I am indeed smart enough to learn how programs others wrote work, I look forward to making even more programs do things they where never destined to do.

Special thanks to Hiltjo Posthuma from for his work on Sfeed and Mark Oteiza for the player-media.el package