Elfeed

I’ve become pretty addicted to the Elfeed RSS reader. However, I haven’t made much use of its tagging capabilities until recently. I noticed that, whenever I thought I might want to keep track of the content of a blog, I would mark it “unread” after I’d read it, to make sure I didn’t lose it in the deep mists of time. This worked for the first 4 months or so, but now my list of unreads is growing enormously. So I wanted to have a “starred” tag which would do this work for me. I also wanted a keybinding that would apply the tag right away.

The code below does that for me.

(eval-after-load 'elfeed-search 
  '(define-key elfeed-search-mode-map (kbd "<tab>") 'mwp/elfeed-star))

(defun mwp/elfeed-star ()
  "add a star tag to marked"

  (interactive)
  (elfeed-search-tag-all (list starred))
  )

(defun mwp/elfeed-star ()
  "Apply TAG to all selected entries."
  (interactive )
  (let* ((entries (elfeed-search-selected))
         (tag (intern "starred")))

    (cl-loop for entry in entries do (elfeed-tag entry tag))
    (mapc #'elfeed-search-update-entry entries)
    (unless (use-region-p) (forward-line))))

I also wanted a visual cue to tell me the tagging had been successful – now easy to do, thanks to a very recent commit. I filed an issue as a question – can I do this? – and within 24 hours skeeto had added the functionality. First you have to define an appropriate face for the tag:

(defface elfeed-search-starred-title-face
 '((t :foreground "#f77"))
 "Marks a starred Elfeed entry.")

And then simply add an entry to elfeed-search-face-alist. You can do this via Customize, or follow the instructions in the README, which instruct you to (push '(starred elfeed-search-starred-title-face) elfeed-search-face-alist).

All of this works great for me, and simplifies things quite a bit.

  • http://pragmaticemacs.com/ Ben Maughan

    This is a good tip, but I couldn’t see what the first mwp/elfeed-star is for – isn’t it overwritten by the second one?

    I took inspiration from your code and made a second function to unstar an article (just replace elfeed-tag with elfeed-untag). I assigned the keys “*” and “8” to star/unstar as they make a good mnemonic pair. I also bookmarked the search for +starred and assign a key in elfeed-search-mode-map to quickly get the list of starred articles.

    Thanks for the useful posts.

    • Clément Pit-Claudel

      Ben, any reason why you don’t put both star and unstar on the same key?

      • http://pragmaticemacs.com/ Ben Maughan

        Hmm – because I didn’t think of it! Good idea!