nonreligious · 2022-04-26 20:13
I'm trying to set up [elfeed-score](https://github.com/sp1ff/elfeed-score) for some arXiv feeds -- in the manner of [this blog post](https://cundy.me/post/elfeed/). The scoring and sorting work out great, but the `adjust-tags` rule ([described here](https://www.unwoundstack.com/doc/elfeed-score/0.7-alpha-1/elfeed-score/adjust_002dtags-Rules.html)) for labeling posts which have a score higher or lower than a certain threshold seems to be failing.
This is in my score file:
("adjust-tags"
(:threshold (t . 1000) :tags (t . (starred)) :comment "READ")
(:threshold (nil . -100) :tags (t . (terrible) :comment "DON'T READ") ))
What this *should do* is:
- tag posts with a score greater than or equal to 1000 as `starred`
- tag posts with a score less than or equal to -100 as `terrible`
What ends up happening is that:
- all posts are tagged as `starred`
- posts with a score less than or equal to -100 are tagged as `terrible` as well as `starred`
The value of `elfeed-score-serde-adjust-tags-rule` (the only related variable I can find) is:
(#s(elfeed-score-adjust-tags-rule :threshold
(t . 1000)
:tags
(t starred)
:comment nil)
#s(elfeed-score-adjust-tags-rule :threshold
(nil . -100)
:tags
(t terrible)
:comment nil))
This doesn't seem to change when I update the rule to e.g. make the `starred` threshold 2000.
Can't quite work out where this is going wrong. I thought I'd ask before I open an issue on GitHub.
sp1ff · 2022-04-27 14:06
Author here-- I found the bug. Will try to get a new build out today or tomorrow.
nonreligious · 2022-04-27 14:21
Oh cool, thank you! Thought I was going crazy for a while.
trs_80 · 2022-04-27 21:18
Haha! That's awesome. Great work!
Now I can't help but wonder if he has an RSS feed of r/emacs, especially looking for 'elfeed-score' in the title.
:D
Cheers!
sp1ff · 2022-04-28 02:34
lol I use `elfeed` for comments on all my reddit posts
sp1ff · 2022-04-28 02:37
Nope, just a really embarrassing bug on my part. Build 1.2.3 with the fix is up on [unwoundstack](https://www.unwoundstack.com/distros.html) & should be available on melpa & melpa-stable in a few hours. Give it a try & let me know.
Thanks for pointing it out!
nonreligious · 2022-04-28 08:16
Just installed it via melpa - unfortunately my elfeed-score-file loads with an error: `Invalid read syntax ". in wrong context`
It's definitely coming from the `adjust-tags` rule:
(("adjust-tags"
(:threshold (t . 100) :tags (t . (starred)) :comment "READ")
(:threshold (nil . -100) :tags (t . (terrible) :comment "DON'T READ")
)))
when I remove it, the error disappears. I've tried adding and removing brackets around the whole rule, but this doesn't change it. It's the very last rule in the file, is there an ordering issue somewhere?
**EDIT** Removing the `:comment` property in the rules fixes this - see my other reply.
nonreligious · 2022-04-28 11:19
Actually, scratch that! Looks like removing the `:comment` property works, i.e.
("adjust-tags"
(:threshold (t . 100) :tags (t . (starred)) )
(:threshold (nil . -100) :tags (t . (terrible) )))
suffices. Sorry if this caused you more hassle!
As far as I can tell the threshold scores work correctly, and everything is highlighted the way I have configured it now. Thank you for the fix, look forward to going through my feeds now!
sp1ff · 2022-04-29 00:35
You're missing the closing paren for `:tags` in your second rule. It should read:
(:threshold (nil . -100) :tags (t . (terrible)) :comment "DON'T READ")
(note the "))" after "terrible").
Not sure how it worked once you removed the comments, TBH. Would you mind sharing your complete score file, or at least a stripped-down version that demonstrates this behavior?
Also, FWIW I use `paredit` for all my lisp coding, including elfeed-score files :) It prevents things like this.
nonreligious · 2022-04-29 07:24
Oops! Thanks for pointing that out, and for the `paredit` recommendation. The extra `)` fixes this as expected.
I actually have `(show-paren-mode 1)` in my configuration, as well as `(electric-pair-mode)`, which means that I get parentheses in pairs and can see how they are paired by placing the cursor on one, but of course that doesn't help syntactically.
`adjust-tags` was the last part of the score my file, so I must have just added/deleted parentheses at the end to make the whole expression pair correctly, as below:
("adjust-tags"
(:threshold (t . 100) :tags (t . (starred)) )
(:threshold (nil . -100) :tags (t . (terrible) )))
Here's a very stripped down version of the whole thing, for completeness, or if anyone else wants to try it:
;;; Elfeed score file -*- lisp -*-
((version 10)
("title")
("content")
("title-or-content"
(:text "cosmological constant" :title-value 50 :content-value 20 :type s
:tags (t arxiv) )
(:text "NNLO" :title-value -150 :content-value -75 :type s
:tags (t arxiv) ))
("tag")
("authors"
(:text "Witten" :value 500 :type s))
("feed")
(mark -2500)
("adjust-tags"
(:threshold (t . 100) :tags (t . (starred)) )
(:threshold (nil . -100) :tags (t . (terrible) ))))