sp1ff / elfeed-score Goto Github PK
View Code? Open in Web Editor NEWGnus-style scoring for elfeed
License: GNU General Public License v3.0
Gnus-style scoring for elfeed
License: GNU General Public License v3.0
When I run (elfeed-score-enable)
I get the error "Missing mandatory field title-value"
Presently, rules & their state (last match time, # hits, &c) are flushed to disk when:
elfeed-score-score
or elfeed-score-search
)elfeed-score-serde-write-score-file
)elfeed-score-unload
)Otherwise, if you simply leave elfeed-score in place, day after day, reading news & relying on the Elfeed new entry hook to score entries, a lot of state accumulates in-memory that won't be written to disk.
Worse, if you update your score file by hand (to add a new rule, say), and then carry out one of the above three operations, your changes will be overwritten.
elfeed-score needs to:
elfeed-search-fetch
operation completes, but since that's asynchronous, it's touchy. We could setup a feed update hook & write every time the work queue goes to zero, but there's no clear "I'm done" signal from that operation.It is not clear to me what the right answer is, here. @firmart -- you first raised this issue... thoughts?
Was reading the documentation and noticed in the example config it uses :type :type, wasn't sure if that was a typo or there was a point to having it twice.
(:text "Julia Evans" :value 100 :type :type s :attr t)
Hello,
I'm a big fan of elfeed-score, thanks very much for building and sharing it. I am trying to add some of the new "link" rules and cannot get them to work. I updated elfeed and elfeed-score when I noticed this problem and reviewed the manual but couldn't find how to fix this.
Below is the process I've tried, with some variations:
Before starting elfeed or elfeed-score, I add the following rules to my scoring file:
("link"
(:text "reddit" :value 30 :type s)
(:text "twitter" :value 30 :type s)
I close the file and then start elfeed and call m-x elfeed-score-score
. The messages buffer shows that my score file has been written, and if I re-open it, the two rules in the "link" list are gone. All of my other rules seems to be applying and updating normally. I've also tried calling m-x elfeed-score-load-score-file
after making the change and before scoring.
Toggling the debugger hasn't helped, as apparently whatever is happening is not an error and is not getting captured in the messages buffer. My best current guess is that my rules are somehow not formed right and so they're not getting picked up by the scoring function, and then are overwritten by the "pre-existing rules" (in this case, nothing), but I can't figure out what the problem might be.
Any help troubleshooting would be greatly appreciated.
I'm trying to use elfeed-score
along with elfeed-org
, but somehow elfeed-score
rules are not applied.
I was able to write an advice function to add a random score each time I read the content of an entry:
(defun my/elfeed-show-pre-entry (e)
(let* ((score (elfeed-score--get-score-from-entry e))
(tags (elfeed-entry-tags e)))
(when (not (member 'read tags))
(elfeed-tag e 'read)
(setq score (+ score 1 (random 10)))
(message "Entry %s score raised to %s" (elfeed-entry-id e) score)
(elfeed-score--set-score-on-entry e score))))
(advice-add 'elfeed-show-entry :before #'my/elfeed-show-pre-entry)
(BTW, it would be cool if elfeed-score--get-score-from-entry
and elfeed-score--set-score-on-entry
belongs to the API (not internal))
Just to say that basic operation with elfeed-score
works correctly. Moreover, I ran the following command on an entry (on the elfeed-search
buffer):
(elfeed-score--score-on-title (car (elfeed-search-selected)))
and it returns a positive value. So elfeed.score
is correctly read.
I tried to use the logger, but obviously nothing is logged because the rules was never applied. I don't know what to do now, all entries have a null score despite the remark above. Furthermore, I've even moved my elfeed
database elsewhere and done elfeed-update
, but nothing happened.
I am sorry, I do not know if I have misunderstood the workflow for using elfeed-score.
I presume elfeed-score has to be maintained manually. I wrote the following in my elfeed.score:
((version 7)
("title")
("content")
("title-or-content"
(:text "kerala" :value 1500 :type w
:date 1612278560.2936354 :hits 46)
)
("tag")
("authors")
("feed")
("link")
(mark nil)
("adjust-tags"))
But when I run elfeed-score-score-search, it just removes the rule/rules that I have added.
I am unable to understand how am I supposed to create and save these rules.
Would appreciate help.
Vikas
elfeed-score-write-score-file
depends on pp-to-string
, which, when its argument is long or complex enough, will elide information (printing elipses instead). pp-to-string
in turn uses prin1
, whose behaviour in this regard is governed by a few variables (print-level
and print-length
)-- configuring those first would eliminate this problem.
Somehow, elfeed-score has stopped scoring the items correctly. Everything has a zero score, and my rules are just ignored. It used to work earlier, but has stopped working after I rewrote my .emacs.d, and reinstalled all the emacs packages.
Even after I reload my elfeed.score file (=l), nothing changes. Everthing still has a 0 score.
I am not sure how to debug this.
I just started using this package and it is awesome! However, I was wondering if there is a way to add a rule based on the "Link" text in the entry and not just the url of the feed. For example, when I use some goolge alert rss feed, it generates a url that contains some meaningless numbers, but within this feed each entry has a link that is meaningful (words containing the source webpage, etc.) I would like to be able to run a text match or a regexp against this link text and not the feed url!
for example, look at the image below. I would like to set a filter and reduce the score for the "foodpoisonjournal". I tried to manually add a rule using elfeed-score-maint-add-feed-rule
but the resulting rule is not useful because the feed url is a google link with some random numbers which won't affect future feeds from that same websit "foodpoisonjournal":
("feed"
(:text "https://www.google.com/alerts/feeds/11200774227803531995/15432672011287531238" :value -2000 :type s :attr u))
The userelfeed.score file seems to get rewritten, and when it does, any comments in it are lost. This happens when you use something like "= a t" to add a title rule. Is there a way to prevent that?
In the Readme,
gitub.com
instead of github.com
.When I try to set elfeed-score-rule-stats-file
to a full path in a non-existing directory, elfeed-score errs, instead of creating that directory.
Is it possible to run a function on an entry that is responsible for computing a score? I guess you would implement it as a separate category of rules.
Maybe something like this
(:function func :comment "Computes the score from the word count")
The function would be called with something like this:
(funcall func entry)
and it would be expected to return a numeric score. The main thing I want to be able to do is
compare an entry to entries with a specific tag somehow, e.g. if it is similar to them it gets a higher score, or if it is similar to entries I tagged as not interesting, a lower score.
Maybe there are other things too, e.g. fancier tagging or something. WDYT?
Interactive definition of elfeed-score-enable
requires exactly one argument to be provided all the time. However, README suggests to run (elfeed-score-enable)
without arguments, which leads to error.
Suddenly, I cannot use elfeed-score
anymore after an update. I got weird error like
Debugger entered--Lisp error: (file-already-exists "File already exists" "~/.emacs.d/elfeed.score.~5~")
By inspecting the source code, I realized that we move to a version 6 which uses plist. But currently, for older score files, the code do nothing more than copying it to elfeed.score.~VERSION~
. It would be nice to have a message/error announcing the version change and even nicer to have a function to migrate from old versions.
BTW, it's excellent to have plist. It was a little pain to know which parameter has what purpose without checking the source code or the README.
Is there a way to score based on the link of an entry?
For clarity:
Say I subscribe to the feed example.com/feed.rss
that contains items that links to articles like example.com/news/content.html
and example.com/sports/content.html
. Can I in this instance have one score for news-links and another for sports-links?
This was raised on Reddit.
Or it should be configurable.
Because of how add-hook
operates, if elfeed score is enable after all other elfeed configuration is completed (including addition of taggers via elfeed-make-tagger
) it will be the first thing run on a new entry.
The function elfeed-score-enable
installs (or not) the sort function and load the score file. It would be nice to separate the snippet which loads the score file to a separate function so that loading and unloading functions are both available. When I modified my score file, I used elfeed-score-enable
to load it, but the denomination sounds unnatural.
Hello,
Thank you for this useful package!
I have experienced an issue of elfeed-update (especially at the fresh startup) being slow and freezing the emacs.
And, as suggested here Only redraw search buffer after refresh completes #293, I have advised the elfeed-update-feed as below, which solves my problem.
(use-package! elfeed
:config
(setq rmh-elfeed-org-files
(list "~/org/gtd/elfeed.org")))
;; REF fix for freezing during elfeed-update
;; caused by search ui
(defvar ap/elfeed-update-complete-hook nil
"Functions called with no arguments when `elfeed-update' is finished.")
(defvar ap/elfeed-updates-in-progress 0
"Number of feed updates in-progress.")
(defvar ap/elfeed-search-update-filter nil
"The filter when `elfeed-update' is called.")
(defun ap/elfeed-update-complete-hook (&rest ignore)
"When update queue is empty, run `ap/elfeed-update-complete-hook' functions."
(when (= 0 ap/elfeed-updates-in-progress)
(run-hooks 'ap/elfeed-update-complete-hook)))
(add-hook 'elfeed-update-hooks #'ap/elfeed-update-complete-hook)
(defun ap/elfeed-update-message-completed (&rest _ignore)
(message "Feeds updated"))
(add-hook 'ap/elfeed-update-complete-hook #'ap/elfeed-update-message-completed)
(defun ap/elfeed-search-update-restore-filter (&rest ignore)
"Restore filter after feeds update."
(when ap/elfeed-search-update-filter
(elfeed-search-set-filter ap/elfeed-search-update-filter)
(setq ap/elfeed-search-update-filter nil)))
(add-hook 'ap/elfeed-update-complete-hook #'ap/elfeed-search-update-restore-filter)
(defun ap/elfeed-search-update-save-filter (&rest ignore)
"Save and change the filter while updating."
(setq ap/elfeed-search-update-filter elfeed-search-filter)
(setq elfeed-search-filter "#0"))
;; NOTE: It would be better if this hook were run before starting the feed updates, but in
;; `elfeed-update', it happens afterward.
(add-hook 'elfeed-update-init-hooks #'ap/elfeed-search-update-save-filter)
(defun ap/elfeed-update-counter-inc (&rest ignore)
(cl-incf ap/elfeed-updates-in-progress))
(advice-add #'elfeed-update-feed :before #'ap/elfeed-update-counter-inc)
(defun ap/elfeed-update-counter-dec (&rest ignore)
(cl-decf ap/elfeed-updates-in-progress)
(when (< ap/elfeed-updates-in-progress 0)
;; Just in case
(setq ap/elfeed-updates-in-progress 0)))
(add-hook 'elfeed-update-hooks #'ap/elfeed-update-counter-dec)
However, when I use it with elfeed-score, emacs freezes again at the initial elfeed-update call. Here is the config:
(use-package! elfeed-score
:after elfeed
:config
(setq elfeed-score-serde-score-file "~/org/feed/elfeed.score")
(setq elfeed-score-log-level 'debug)
(elfeed-score-enable)
(define-key elfeed-search-mode-map "=" elfeed-score-map))
Note that I have around 300 RSS entries. Is this expected or am I missing something?
Adjust elfeed-score-score
and elfeed-score-explain
in such a way that it takes accounts for manual scoring. Currently, all manually added score of an entry are erased when calling elfeed-score-score
.
I've been using elfeed-score for quite a few months now, and it's working brilliantly.
One feature that would be really useful is some sort of interactive 'explain' function. At the moment, I have an elfeed.score file which is almost 500 lines long, and so sometimes it's a bit of a mystery why a particular entry that I expect to have a high score has a low score. It would be really useful to be able to press e.g. = e
and have a list of (match text, score contribution)
pop up in the minibuffer, in a similar way that currently I can press = g
and have the entry's score pop up.
I know it's possible to set the debug state and look at the log to see this, but having it on an interactive function would make the workflow much easier.
I took a quick look but couldn't quite see how to get this to work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.