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:
parent
4152ca6032
commit
74e51d906c
3 changed files with 8 additions and 10 deletions
|
@ -84,7 +84,7 @@ Likewise, if you use [[https://github.com/rnadler/elfeed-curate][elfeed-curate]]
|
|||
|
||||
** 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:
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ The function takes an entry argument for extracting the desired value."
|
|||
(list #'elfeed-export--include-entry-by-tag-p)
|
||||
"Entries that match all of these predicates are exported.
|
||||
|
||||
Each predicate accepts an entry and a feed object and should
|
||||
return t when the entry should be exported."
|
||||
Each predicate accepts an entry object and should return t when
|
||||
the entry should be exported."
|
||||
:group 'elfeed-export
|
||||
:type '(repeat function))
|
||||
|
||||
|
@ -73,7 +73,7 @@ return t when the entry should be exported."
|
|||
:group 'elfeed-export
|
||||
: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)))
|
||||
(and
|
||||
(or (not elfeed-export-include-tags)
|
||||
|
@ -107,10 +107,9 @@ return t when the entry should be exported."
|
|||
(defun elfeed-export-filter-entries (entries)
|
||||
"Filter ENTRIES according to all predictates in `elfeed-export-predicates'."
|
||||
(seq-filter (lambda (entry)
|
||||
(let ((feed (elfeed-entry-feed entry)))
|
||||
(seq-every-p (lambda (pred)
|
||||
(funcall pred entry feed))
|
||||
elfeed-export-predicates)))
|
||||
(funcall pred entry))
|
||||
elfeed-export-predicates))
|
||||
entries))
|
||||
|
||||
(defun elfeed-export--entries ()
|
||||
|
|
|
@ -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
|
||||
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.
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue