summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-score.el
diff options
context:
space:
mode:
authorAlex Bochannek <alex@bochannek.com>2020-09-12 14:04:02 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-12 14:04:02 +0200
commit4c3f3bf25623c936ca07249203147ae0332d64ed (patch)
tree5763d647ff0518b7d26e376c1a8234dd2df5a9a0 /lisp/gnus/gnus-score.el
parenta4bfb0bc5c14e002c0926fc320aeb4a3fc261447 (diff)
Support scoring on article age interactively in Gnus
* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Support scoring on article age in interactive scoring (bug#43270).
Diffstat (limited to 'lisp/gnus/gnus-score.el')
-rw-r--r--lisp/gnus/gnus-score.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 6a0e8ceb998..ffc6b8ca34e 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -862,6 +862,18 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
(setq match (string-to-number match)))
(set-text-properties 0 (length match) nil match))
+ ;; Modify match and type for article age scoring.
+ (if (string= "date" (nth 0 (assoc header gnus-header-index)))
+ (let ((age (string-to-number match)))
+ (if (or (< age 0)
+ (string= "0" match))
+ (user-error "Article age must be a positive number"))
+ (setq match age
+ type (cond ((eq type 'after)
+ '<)
+ ((eq type 'before)
+ '>)))))
+
(unless (eq date 'now)
;; Add the score entry to the score file.
(when (= score gnus-score-interactive-default-score)