[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0dd7e6e3aea: Have gnus-summary-limit-to-age operate on calendar d
From: |
Eric Abrahamsen |
Subject: |
master 0dd7e6e3aea: Have gnus-summary-limit-to-age operate on calendar days |
Date: |
Fri, 13 Oct 2023 20:01:16 -0400 (EDT) |
branch: master
commit 0dd7e6e3aeac1ab0a03f2ed2ad108deecde82447
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Have gnus-summary-limit-to-age operate on calendar days
Reported and patched by Ćukasz Stelmach <stlman@poczta.fm>.
* lisp/gnus/gnus-sum.el (gnus-summary-limit-to-age): Rather than
24-hour blocks. Also use `read-number', and drop the confusing option
to reverse younger/older both with the prefix argument and with a
negative number.
---
lisp/gnus/gnus-sum.el | 40 +++++++++++++++-------------------------
1 file changed, 15 insertions(+), 25 deletions(-)
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index a3be5577f7a..f576d4e6147 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8331,39 +8331,29 @@ articles."
(defun gnus-summary-limit-to-age (age &optional younger-p)
"Limit the summary buffer to articles that are older than (or equal) AGE
days.
-If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
-articles that are younger than AGE days."
+Days are counted from midnight to midnight, and now to the
+previous midnight counts as day one. If YOUNGER-P (the prefix)
+is non-nil, limit the summary buffer to articles that are younger
+than AGE days."
(interactive
- (let ((younger current-prefix-arg)
- (days-got nil)
- days)
- (while (not days-got)
- (setq days (if younger
- (read-string "Limit to articles younger than (in days,
older when negative): ")
- (read-string
- "Limit to articles older than (in days, younger when
negative): ")))
- (when (> (length days) 0)
- (setq days (read days)))
- (if (numberp days)
- (progn
- (setq days-got t)
- (when (< days 0)
- (setq younger (not younger))
- (setq days (* days -1))))
- (message "Please enter a number.")
- (sleep-for 1)))
+ (let* ((younger current-prefix-arg)
+ (days (read-number
+ (if younger "Limit to articles younger than days: "
+ "Limit to articles older than days: "))))
(list days younger))
gnus-summary-mode)
(prog1
- (let ((data gnus-newsgroup-data)
- (cutoff (days-to-time age))
- articles d date is-younger)
+ (let* ((data gnus-newsgroup-data)
+ (now (append '(0 0 0) (cdddr (decode-time))))
+ (delta (make-decoded-time :day (* -1 (- age 1))))
+ (cutoff (encode-time (decoded-time-add now delta)))
+ articles d date is-younger)
(while (setq d (pop data))
(when (and (mail-header-p (gnus-data-header d))
(setq date (mail-header-date (gnus-data-header d))))
(setq is-younger (time-less-p
- (time-since (gnus-date-get-time date))
- cutoff))
+ cutoff
+ (gnus-date-get-time date)))
(when (if younger-p
is-younger
(not is-younger))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 0dd7e6e3aea: Have gnus-summary-limit-to-age operate on calendar days,
Eric Abrahamsen <=