1
0
Fork 0

Add example on how to add a feed-based filter

This commit is contained in:
Bram Schoenmakers 2024-08-05 21:59:10 +02:00
parent 74e51d906c
commit fbbe462de6
Signed by: bram
GPG key ID: 0CCD19DFDC63258F
2 changed files with 58 additions and 9 deletions

View file

@ -86,6 +86,8 @@ Likewise, if you use [[https://github.com/rnadler/elfeed-curate][elfeed-curate]]
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. 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 tag
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:
#+begin_src elisp #+begin_src elisp
@ -94,6 +96,19 @@ By default, there is a tag-based predicate, which is configured by the variables
By default, items tagged as =noexport= are omitted. By default, items tagged as =noexport= are omitted.
*** By feed
To export entries for a certain RSS feed only, use the following configuration snippet:
#+begin_src elisp
(add-to-list 'elfeed-export-predicates
(lambda (entry)
(let* ((feed (elfeed-entry-feed entry))
(title (elfeed-feed-title feed))
(_url (elfeed-feed-url feed)))
(string-match-p (rx "LWN.net") title))))
#+end_src
** COMMENT Attribution :noexport: ** COMMENT Attribution :noexport:
The code to generate the table of configuration items was inspired by an idea of [[https://xenodium.com/generating-elisp-org-docs/][Álvaro Ramírez]] (a.k.a. xenodium). The code to generate the table of configuration items was inspired by an idea of [[https://xenodium.com/generating-elisp-org-docs/][Álvaro Ramírez]] (a.k.a. xenodium).

View file

@ -20,6 +20,11 @@ Configuration
* Customize export fields:: * Customize export fields::
* Customize entry filters:: * Customize entry filters::
Customize entry filters
* By tag::
* By feed::
 
File: elfeed-export.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top File: elfeed-export.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top
@ -116,24 +121,53 @@ 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 one argument: the entry object. export. Each predicate takes one argument: the entry object.
By default, there is a tag-based predicate, which is configured by * Menu:
the variables elfeed-export-include-tags and
elfeed-export-exclude-tags. They're a list of symbols that represent * By tag::
a tag. E.g., to export unread items only, use: * By feed::

File: elfeed-export.info, Node: By tag, Next: By feed, Up: Customize entry filters
3.2.1 By tag
------------
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:
(add-to-list 'elfeed-export-include-tags 'unread) (add-to-list 'elfeed-export-include-tags 'unread)
By default, items tagged as noexport are omitted. By default, items tagged as noexport are omitted.

File: elfeed-export.info, Node: By feed, Prev: By tag, Up: Customize entry filters
3.2.2 By feed
-------------
To export entries for a certain RSS feed only, use the following
configuration snippet:
(add-to-list 'elfeed-export-predicates
(lambda (entry)
(let* ((feed (elfeed-entry-feed entry))
(title (elfeed-feed-title feed))
(_url (elfeed-feed-url feed)))
(string-match-p (rx "LWN.net") title))))
 
Tag Table: Tag Table:
Node: Top87 Node: Top87
Node: Introduction357 Node: Introduction406
Node: Installation1043 Node: Installation1092
Node: Configuration1448 Node: Configuration1497
Node: Customize export fields2182 Node: Customize export fields2231
Node: Customize entry filters3279 Node: Customize entry filters3328
Node: By tag3740
Node: By feed4214
 
End Tag Table End Tag Table