From 3d679ccf28b7204fcce4bfe0e4775d5aa313a6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Fri, 27 Dec 2024 03:17:39 +0200 Subject: [PATCH 1/2] elfeed-make-tagger: Add more possible matches Also fix some minor errors reported by checkdoc. --- elfeed.el | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/elfeed.el b/elfeed.el index 029e729..d2af333 100644 --- a/elfeed.el +++ b/elfeed.el @@ -561,15 +561,17 @@ called interactively, SAVE is set to t." ;; New entry filtering (cl-defun elfeed-make-tagger - (&key feed-title feed-url entry-title entry-link after before + (&key feed-title feed-url feed-author entry-title entry-link + entry-enclosure entry-content-type after before add remove callback) - "Create a function that adds or removes tags on matching entries. - -FEED-TITLE, FEED-URL, ENTRY-TITLE, and ENTRY-LINK are regular -expressions or a list (not ), which indicates a negative -match. AFTER and BEFORE are relative times (see -`elfeed-time-duration'). Entries must match all provided -expressions. If an entry matches, add tags ADD and remove tags + "Create a function that adds, removes tags or does CALLBACK on matching entries. + +FEED-TITLE, FEED-URL, FEED-AUTHOR, ENTRY-TITLE, ENTRY-LINK, +ENTRY-ENCLOSURE and ENTRY-CONTENT-TYPE +are regular expressions or a list \(not \), +which indicates a negative match. AFTER and BEFORE are relative times +\(see `elfeed-time-duration'\). Entries must match all provided +expressions. If an entry matches, add tags ADD and remove tags REMOVE. Examples, @@ -601,8 +603,11 @@ The returned function should be added to `elfeed-new-entry-hook'." (when (and (match feed-title (elfeed-feed-title feed)) (match feed-url (elfeed-feed-url feed)) + (match feed-author (elfeed-feed-author feed)) (match entry-title (elfeed-entry-title entry)) (match entry-link (elfeed-entry-link entry)) + (match entry-content-type (elfeed-entry-content-type entry)) + (match entry-enclosure (elfeed-entry-enclosures entry)) (or (not after-time) (> date (- (float-time) after-time))) (or (not before-time) (< date (- (float-time) before-time)))) (when add From b5f9fffcb64e740bd8d10a783184b8ac4bbb7492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Fri, 27 Dec 2024 04:02:40 +0200 Subject: [PATCH 2/2] elfeed-make-tagger: Make it possible to match against values from meta --- elfeed.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/elfeed.el b/elfeed.el index d2af333..c2fba25 100644 --- a/elfeed.el +++ b/elfeed.el @@ -563,13 +563,16 @@ called interactively, SAVE is set to t." (cl-defun elfeed-make-tagger (&key feed-title feed-url feed-author entry-title entry-link entry-enclosure entry-content-type after before - add remove callback) + feed-meta entry-meta add remove callback) "Create a function that adds, removes tags or does CALLBACK on matching entries. FEED-TITLE, FEED-URL, FEED-AUTHOR, ENTRY-TITLE, ENTRY-LINK, -ENTRY-ENCLOSURE and ENTRY-CONTENT-TYPE +ENTRY-ENCLOSURE, ENTRY-CONTENT-TYPE are regular expressions or a list \(not \), -which indicates a negative match. AFTER and BEFORE are relative times +which indicates a negative match. FEED-META and ENTRY-META are +a list of key and value where car is the key and cadr is value. +The key and value are matched against the respective meta's. +AFTER and BEFORE are relative times \(see `elfeed-time-duration'\). Entries must match all provided expressions. If an entry matches, add tags ADD and remove tags REMOVE. @@ -604,10 +607,12 @@ The returned function should be added to `elfeed-new-entry-hook'." (match feed-title (elfeed-feed-title feed)) (match feed-url (elfeed-feed-url feed)) (match feed-author (elfeed-feed-author feed)) + (match (car feed-meta) (elfeed-meta feed (cadr feed-meta))) (match entry-title (elfeed-entry-title entry)) (match entry-link (elfeed-entry-link entry)) (match entry-content-type (elfeed-entry-content-type entry)) (match entry-enclosure (elfeed-entry-enclosures entry)) + (match (car entry-meta) (elfeed-meta entry (cadr entry-meta))) (or (not after-time) (> date (- (float-time) after-time))) (or (not before-time) (< date (- (float-time) before-time)))) (when add