Open jkitchin opened 7 years ago
Filtering to entries with a particular tag is easy since that's the whole point of the filter. Just put an "important" tag on important entries.
As for filtering by function, that's an interesting idea for a potential feature. I'm imagining something like:
(defun monday-entry-p (entry)
(let ((time (seconds-to-time (elfeed-entry-date entry))))
(= 1 (nth 6 (decode-time time)))))
And then in the filter a ? applies the named predicate:
?monday-entry-p
Is that something like you mean?
I wanted to filter by entries that were tagged "important OR relevant", but not necessarily both. That would be easy to do with your function approach. I thought there might be something like "important | relevant" though.
I get what you're saying now. The main reason OR is not supported is due to my own parsing laziness. I don't object to the concept, but I'm currently not sure how I'd want to support it syntax-wise.
No problem. Your function idea should make it easy.
I describe my use case
Every day I receive hundreds (over 1000) rss feeds from different sites (YouTube, News1, News2 ..., etc). So, I have no time to read them all, therefore I mark only interesting titles by tags (using + key). After that I mark all titles read (using C-x h r). Then I find a free time to read marked feeds after some hours or after some days.
I don't remember all tags which I used to mark feeds. I cannot view all used tags through the user interface to know them. I cannot view feeds by tags for "videos and for News1" because videos has only one tag +v and News1 has only one tag +n1.
I would enter to the filter string "+v,+n1" to get videos and News1 or "+n1,+n2" to get News1 and News2 where the comma means OR.
If I enter to the filter string "+v +n1" then I don't see anything because the space means AND. I have no tag +n1 on videos and I have no tag +v on news.
In the past I've thought a little about having an OR operator. I imagine it looking something like how DuckDuckGo used to do it:
https://web.archive.org/web/20161126012624/https://duck.co/help/results/syntax
I like how the operator is its own separate token, and precedence is implicit for the common cases. I haven't taken the time to extend the filter parser (elfeed-search-parse-filter) and filter engine (elfeed-search-compile-filter) to support something like that.
The operator wouldn't necessarily have to be spelled "OR". It could be a symbol like "|".
So I'd definitely like to have an OR operator, but I don't really want it implemented as the comma operator you proposed.
Also note the issue about all used tags. At the moment I can't know all tags set on read feeds, I can only remember them or write somewhere. I can remember ten different tags and use them everytime, but I can't remember hundred different tags.
Maybe command like "t" will list all tags in a separate window. I imagine 100 tags with length 20 characters every, so it should be a wide window (not status line) with a long list sorted alphabetically.
Maybe completion can help with this. As long as a list of tags is computable, it seems like you could get tab to complete or offer a list of tags to choose from.
Yes:
(completing-read "Tag: " (elfeed-db-get-all-tags))
Any progress on the OR feature?
I imagine, this problem may be immensely benefited by translate the filter a lambda predicate, where theses syntax of +<tag name>
-<tag name>
is a convienient way of syntax sugaring.
For example, +<tag name>
becomes (lambda (entry) (elfeed-entry-has-tag-p <entry> <tag name>)
.
This would make OR <tag1> <tag2>
very trivial to translate:
(lambda (entry)
(or (elfeed-entry-has-tag-p entry <tag1>)
(elfeed-entry-has-tag-p entry <tag2>)
If anything, I would also suggest using a lispy syntax as well, i.e.:
Or? (OR <exp> <exp>)
And? (AND <exp> <exp>)
Tag? (tag <tag string>)
Text? "just normal string"
6 months ago? (ago 6 m)
3 days ago? (ago 3 d)
Is it possible to write a filter that shows entries tagged important or relevant? Or perhaps filter on some truthy function?