From a1aff041b833f74bc4a421c92916ac1b8ccde0ca Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Tue, 21 Sep 2010 18:58:02 +0200 Subject: [PATCH] Allow returning the cutoff time for oldness in addition to being a predicate. --- lisp/ChangeLog | 3 +++ lisp/nnmail.el | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 84baaff12..9fdac2c4c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-09-21 Lars Magne Ingebrigtsen + * nnmail.el (nnmail-expired-article-p): Allow returning the cutoff time + for oldness in addition to being a predicate. + * nnimap.el (nnimap-request-group): When we have zero articles, return the right data to Gnus. (nnimap-request-expire-articles): Only delete articles immediately if diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 3e6cee825..e17465ab0 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1858,9 +1858,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (run-hooks 'nnmail-post-get-new-mail-hook)))) (defun nnmail-expired-article-p (group time force &optional inhibit) - "Say whether an article that is TIME old in GROUP should be expired." + "Say whether an article that is TIME old in GROUP should be expired. +If TIME is nil, then return the cutoff time for oldness instead." (if force - t + (if (null time) + (current-time) + t) (let ((days (or (and nnmail-expiry-wait-function (funcall nnmail-expiry-wait-function group)) nnmail-expiry-wait))) @@ -1871,14 +1874,18 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." nil) ((eq days 'immediate) ;; We expire all articles on sight. - t) + (if (null time) + (current-time) + t)) ((equal time '(0 0)) ;; This is an ange-ftp group, and we don't have any dates. nil) ((numberp days) (setq days (days-to-time days)) ;; Compare the time with the current time. - (ignore-errors (time-less-p days (time-since time)))))))) + (if (null time) + (time-minus (current-time) days) + (ignore-errors (time-less-p days (time-since time))))))))) (declare-function gnus-group-mark-article-read "gnus-group" (group article)) -- 2.25.1