feat: skip certain tags in sync

This commit is contained in:
Pavel Korytov 2023-08-23 12:25:25 +03:00
parent 96ffc25862
commit 6bad19a7d4
2 changed files with 49 additions and 2 deletions

View file

@ -282,6 +282,21 @@ If you set:
Then =RET= and =M-RET= in the =elfeed-summary= buffer will open the search buffer in other window.
=elfeed-summary-width= regulates the width of the remaining summary window in this case. It is useful because the data in the search buffer is generally wider than in the summary buffer. The variable can also be set to =nil= to disable this behavior.
** Skipping feeds
[[https://tt-rss.org/][tt-rss]] has a feature to disable updating a particular feed but keep it in the feed list. I also want that for elfeed.
To use that, set =elfeed-summary-skip-sync-tag= to some value:
#+begin_src emacs-lisp
(setq elfeed-summary-skip-sync-tag 'skip)
#+end_src
And tag the feeds you want to skip with this tag. Then, running =M-x elfeed-summary-update= will skip them. This won't affect =M-x elfeed-update= unless you:
#+begin_src emacs-lisp
(advice-add #'elfeed-update :override #'elfeed-summary-update)
#+end_src
Also watch out if you use [[https://github.com/remyhonig/elfeed-org][elfeed-org]] and want to use the =ignore= tag, because this package omits feeds with this tag altogether (configurable by =rmh-elfeed-org-ignore-tag=).
** Other options
Also take a look at =M-x customize-group elfeed-summary= for the rest of available options.
* Ideas and alternatives

View file

@ -288,6 +288,17 @@ Probably should be one of `elfeed-initial-tags'."
:group 'elfeed-summary
:type 'symbol)
(defcustom elfeed-summary-skip-sync-tag nil
"Do not sync feeds with this tag.
Feeds are tagged in `elfeed-feeds'. Watch out if you're using
elfeed-org, because `rmh-elfeed-org-ignore-tag' is set to \"ignore\"
by default, which seems to remove the feed from `elfeed-feeds'
altogether. This options keeps the feed there, just makes
`elfeed-summary-update' to skip in sync."
:group 'elfeed-summary
:type 'symbol)
(defcustom elfeed-summary-feed-face-fn #'elfeed-summary--feed-face-fn
"Function to get the face of the feed entry.
@ -1461,6 +1472,27 @@ summary buffer."
(with-current-buffer buffer
(elfeed-summary--refresh))))
(defun elfeed-summary--feed-list ()
"Return a flat list version of `elfeed-feeds'.
This is a modification of `elfeed-feed-list' that takes
`elfeed-summary-skip-sync-tag' in account. The return value is a list
of string."
;; Validate elfeed-feeds and fail early rather than asynchronously later.
(dolist (feed elfeed-feeds)
(unless (cl-typecase feed
(list (and (stringp (car feed))
(cl-every #'symbolp (cdr feed))))
(string t))
;; Chris, package-lint doesn't like your code :P
(error "`elfeed-feeds' malformed, bad entry: %S" feed)))
(cl-loop for feed in elfeed-feeds
when (and (listp feed)
(not (memq elfeed-summary-skip-sync-tag
(cdr feed))))
collect (car feed)
else if (not (listp feed)) collect feed))
(defun elfeed-summary-update ()
"Update all the feeds in `elfeed-feeds' and the summary buffer."
(interactive)
@ -1483,7 +1515,7 @@ summary buffer."
(byte-code-function-p hook))))
elfeed-update-hooks))
(let* ((elfeed--inhibit-update-init-hooks t)
(remaining-feeds (elfeed-feed-list))
(remaining-feeds (elfeed-summary--feed-list))
(elfeed-update-closure
(lambda (url)
(message (if (> (elfeed-queue-count-total) 0)
@ -1507,7 +1539,7 @@ summary buffer."
elfeed-summary-refresh-on-each-update)
(elfeed-summary--refresh-if-exists)))))
(add-hook 'elfeed-update-hooks elfeed-update-closure)
(mapc #'elfeed-update-feed (elfeed--shuffle (elfeed-feed-list)))
(mapc #'elfeed-update-feed (elfeed--shuffle (elfeed-summary--feed-list)))
(run-hooks 'elfeed-update-init-hooks)
(elfeed-db-save)))