1
0
Fork 0

Entry filters only accept an entry object

Simplify at a bit by no longer passing a feed object. If a filter
needs it, it can be retrieved with 'elfeed-entry-feed'.
This commit is contained in:
Bram Schoenmakers 2024-08-04 13:07:19 +02:00
parent 4152ca6032
commit 74e51d906c
Signed by: bram
GPG key ID: 0CCD19DFDC63258F
3 changed files with 8 additions and 10 deletions

View file

@ -84,7 +84,7 @@ Likewise, if you use [[https://github.com/rnadler/elfeed-curate][elfeed-curate]]
** Customize entry filters ** Customize entry filters
The variable ~elfeed-export-predicates~ is a list of predicates applied to each entry. An entry that matches all predicates makes it into the export. Each predicate takes two arguments: the entry object and the corresponding feed URL. The variable ~elfeed-export-predicates~ is a list of predicates applied to each entry. An entry that matches all predicates makes it into the export. Each predicate takes one argument: the entry object.
By default, there is a tag-based predicate, which is configured by the variables ~elfeed-export-include-tags~ and ~elfeed-export-exclude-tags~. They're a list of symbols that represent a tag. E.g., to export unread items only, use: By default, there is a tag-based predicate, which is configured by the variables ~elfeed-export-include-tags~ and ~elfeed-export-exclude-tags~. They're a list of symbols that represent a tag. E.g., to export unread items only, use:

View file

@ -58,8 +58,8 @@ The function takes an entry argument for extracting the desired value."
(list #'elfeed-export--include-entry-by-tag-p) (list #'elfeed-export--include-entry-by-tag-p)
"Entries that match all of these predicates are exported. "Entries that match all of these predicates are exported.
Each predicate accepts an entry and a feed object and should Each predicate accepts an entry object and should return t when
return t when the entry should be exported." the entry should be exported."
:group 'elfeed-export :group 'elfeed-export
:type '(repeat function)) :type '(repeat function))
@ -73,7 +73,7 @@ return t when the entry should be exported."
:group 'elfeed-export :group 'elfeed-export
:type '(repeat symbol)) :type '(repeat symbol))
(defun elfeed-export--include-entry-by-tag-p (entry _feed) (defun elfeed-export--include-entry-by-tag-p (entry)
(let ((tags (elfeed-entry-tags entry))) (let ((tags (elfeed-entry-tags entry)))
(and (and
(or (not elfeed-export-include-tags) (or (not elfeed-export-include-tags)
@ -107,10 +107,9 @@ return t when the entry should be exported."
(defun elfeed-export-filter-entries (entries) (defun elfeed-export-filter-entries (entries)
"Filter ENTRIES according to all predictates in `elfeed-export-predicates'." "Filter ENTRIES according to all predictates in `elfeed-export-predicates'."
(seq-filter (lambda (entry) (seq-filter (lambda (entry)
(let ((feed (elfeed-entry-feed entry)))
(seq-every-p (lambda (pred) (seq-every-p (lambda (pred)
(funcall pred entry feed)) (funcall pred entry))
elfeed-export-predicates))) elfeed-export-predicates))
entries)) entries))
(defun elfeed-export--entries () (defun elfeed-export--entries ()

View file

@ -114,8 +114,7 @@ File: elfeed-export.info, Node: Customize entry filters, Prev: Customize expor
The variable elfeed-export-predicates is a list of predicates applied The variable elfeed-export-predicates is a list of predicates applied
to each entry. An entry that matches all predicates makes it into the to each entry. An entry that matches all predicates makes it into the
export. Each predicate takes two arguments: the entry object and the export. Each predicate takes one argument: the entry object.
corresponding feed URL.
By default, there is a tag-based predicate, which is configured by By default, there is a tag-based predicate, which is configured by
the variables elfeed-export-include-tags and the variables elfeed-export-include-tags and