Skip to content

Tag Hooks ​

The last example assumes you’ve tagged posts with ‘youtube’. You probably want to do this sort of thing automatically, either through the "autotags" feature mentioned above, or with the ‘elfeed-new-entry-hook’. Functions in this hook are called with new entries, allowing them to be manipulated, such as adding tags.

emacs-lisp
;; Mark all YouTube entries
(add-hook 'elfeed-new-entry-hook
          (elfeed-make-tagger :feed-url "youtube\\.com"
                              :add '(video youtube)))

Avoiding tagging old entries as ‘unread’:

emacs-lisp
;; Entries older than 2 weeks are tagged as read
(add-hook 'elfeed-new-entry-hook
          (elfeed-make-tagger :before "2 weeks ago"
                              :remove 'unread))

Or building your own subset feeds:

emacs-lisp
(add-hook 'elfeed-new-entry-hook
          (elfeed-make-tagger :feed-url "example\\.com"
                              :entry-title '(not "something interesting")
                              :add 'junk
                              :remove 'unread))

Use ‘M-x elfeed-apply-hooks-now’ to apply ‘elfeed-new-entry-hook’ to all existing entries. Otherwise hooks will only apply to new entries on discovery.