GNU bug report logs -
#43270
27.1; [PATCH] Enhance gnus-score-date to support scoring by article age
Previous Next
Reported by: Alex Bochannek <alex <at> bochannek.com>
Date: Tue, 8 Sep 2020 08:43:01 UTC
Severity: normal
Tags: fixed, patch
Found in version 27.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
The below patch to Gnus allows for scoring based on article age.
For example:
(("date"
(7 10 nil <)
(7 -10 nil >)
(14 -10 nil >)))
results in articles less than a week old to get a 10 point increase,
older than a week a 10 point decrease, and older than two weeks a
cumulative 20 point decrease.
I am also including a documentation change. I have not made any changes
to interactive scoring.
[gnus-score.el.diff (text/x-patch, inline)]
*** /Users/awb/Desktop/gnus-score.el.~1~ 2020-07-27 14:21:49.000000000 -0700
--- /Users/awb/Desktop/gnus-score.el 2020-09-07 12:21:36.000000000 -0700
***************
*** 1370,1378 ****
(setq
err
(cond
! ((if (member (downcase type) '("lines" "chars"))
! (not (numberp (car s)))
! (not (stringp (car s))))
(format "Invalid match %s in %s" (car s) file))
((and (cadr s) (not (integerp (cadr s))))
(format "Non-integer score %s in %s" (cadr s) file))
--- 1370,1381 ----
(setq
err
(cond
! ((cond ((member (downcase type) '("lines" "chars"))
! (not (numberp (car s))))
! ((string= (downcase type) "date")
! (not (or (numberp (car s))
! (stringp (car s)))))
! (t (not (stringp (car s)))))
(format "Invalid match %s in %s" (car s) file))
((and (cadr s) (not (integerp (cadr s))))
(format "Non-integer score %s in %s" (cadr s) file))
***************
*** 1690,1698 ****
--- 1693,1711 ----
((eq type 'after)
(setq match-func 'string<
match (gnus-date-iso8601 (nth 0 kill))))
+ ((eq type '<)
+ (setq type 'after
+ match-func 'gnus-string>
+ match (gnus-time-iso8601
+ (time-add (current-time) (* 86400 (nth 0 kill))))))
((eq type 'before)
(setq match-func 'gnus-string>
match (gnus-date-iso8601 (nth 0 kill))))
+ ((eq type '>)
+ (setq type 'before
+ match-func 'gnus-string>
+ match (gnus-time-iso8601
+ (time-add (current-time) (* -86400 (nth 0 kill))))))
((eq type 'at)
(setq match-func 'string=
match (gnus-date-iso8601 (nth 0 kill))))
[gnus.info.diff (text/x-patch, inline)]
*** /Users/awb/Desktop/gnus.info.~1~ 2020-08-11 22:15:17.000000000 -0700
--- /Users/awb/Desktop/gnus.info 2020-09-07 18:14:22.000000000 -0700
***************
*** 16155,16160 ****
--- 16155,16168 ----
from. Time zones are such wholesome fun for the whole
family, eh?)
+ The two additional match types ‘<’ and ‘>’ take an integer
+ number of days as a match, similar to ‘lines’:
+
+ (7 -10 nil >)
+
+ The above reduces the score for articles older than 7 days
+ at scoring time by 10.
+
“Head, Body, All”
These three match keys use the same match types as the
‘From’ (etc.) header uses.
[Message part 4 (text/plain, inline)]
--
Alex.
This bug report was last modified 4 years and 252 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.