summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorAlex Bochannek <alex@bochannek.com>2020-09-08 11:47:28 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-08 11:47:28 +0200
commit2630bbbcdf4a775d826c18c3209e7adb7a726ef6 (patch)
treeb0bd6cbf6cf58ab6f23252e1fffe68448d1f0682 /lisp/gnus
parent0fb54254423cd62aea12ab3c76c1da6912e988e1 (diff)
downloademacs-2630bbbcdf4a775d826c18c3209e7adb7a726ef6.tar.gz
Introduce a new Gnus scoring method (for article age)
* doc/misc/gnus.texi (Score File Format): Document it. * lisp/gnus/gnus-score.el (gnus-score-check-syntax): Add support for the new date methods < and > (bug#43270). (gnus-score-date): Allow scoring on dates by age.
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/gnus-score.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 46b70eaf275..c5156a195a3 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1370,9 +1370,12 @@ If FORMAT, also format the current score file."
(setq
err
(cond
- ((if (member (downcase type) '("lines" "chars"))
- (not (numberp (car s)))
- (not (stringp (car s))))
+ ((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,9 +1693,19 @@ score in `gnus-newsgroup-scored' by SCORE."
((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))))