emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 32c5bdfa971 2/2: Provide better default value for date in Gnus sc


From: Eric Abrahamsen
Subject: master 32c5bdfa971 2/2: Provide better default value for date in Gnus scoring
Date: Sat, 17 Feb 2024 12:41:40 -0500 (EST)

branch: master
commit 32c5bdfa971220bae37991a298628605c82f866c
Author: Jakub Ječmínek <jecminek.k@gmail.com>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Provide better default value for date in Gnus scoring
    
    Bug#61002, thanks to Kamil Jońca for reporting
    
    * lisp/gnus/gnus-score.el (gnus-summary-score-entry): When scoring on
    Date header, the default value for the prompt should be number of days
    between the date of the article under point, and "now".
---
 lisp/gnus/gnus-score.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index bd19e7d7cd7..479b7496cf1 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -893,9 +893,14 @@ If optional argument `EXTRA' is non-nil, it's a 
non-standard overview header."
                                 (t "permanent"))
                           header
                           (if (< score 0) "lower" "raise"))
-                  (if (numberp match)
-                      (int-to-string match)
-                    match))))
+                   (cond ((numberp match) (int-to-string match))
+                         ((string= header "date")
+                          (int-to-string
+                           (-
+                            (/ (car (time-convert (current-time) 1)) 86400)
+                            (/ (car (time-convert (gnus-date-get-time match) 
1))
+                               86400))))
+                         (t match)))))
 
     ;; If this is an integer comparison, we transform from string to int.
     (if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-integer)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]