From fbbe462de6ed2dcdd4f6aaa4bec56ccb282df873 Mon Sep 17 00:00:00 2001 From: Bram Schoenmakers Date: Mon, 5 Aug 2024 21:59:10 +0200 Subject: [PATCH] Add example on how to add a feed-based filter --- README.org | 15 +++++++++++++ elfeed-export.info | 52 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/README.org b/README.org index 15818bb..18001a2 100644 --- a/README.org +++ b/README.org @@ -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. +*** 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: #+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 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: 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). diff --git a/elfeed-export.info b/elfeed-export.info index e29face..c079d2c 100644 --- a/elfeed-export.info +++ b/elfeed-export.info @@ -20,6 +20,11 @@ Configuration * Customize export fields:: * Customize entry filters:: +Customize entry filters + +* By tag:: +* By feed:: +  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 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: +* Menu: + +* By tag:: +* 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) 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: Node: Top87 -Node: Introduction357 -Node: Installation1043 -Node: Configuration1448 -Node: Customize export fields2182 -Node: Customize entry filters3279 +Node: Introduction406 +Node: Installation1092 +Node: Configuration1497 +Node: Customize export fields2231 +Node: Customize entry filters3328 +Node: By tag3740 +Node: By feed4214  End Tag Table