From 3beab13a43d5730d28693c4000bd7003646d20c6 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sat, 10 Mar 2012 01:51:00 +0100 Subject: [PATCH] Don't expire unexisting (nnimap) articles * gnus-sum.el (gnus-summary-expire-articles): Ditto. * gnus-group.el (gnus-group-expire-articles-1): Don't try to expire messages that don't exist. --- lisp/ChangeLog | 7 +++++++ lisp/gnus-group.el | 10 ++++++---- lisp/gnus-sum.el | 23 +++++++++++++---------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb8e2eaf9..4e591febc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-03-10 Lars Magne Ingebrigtsen + + * gnus-group.el (gnus-group-expire-articles-1): Don't try to expire + messages that don't exist. + + * gnus-sum.el (gnus-summary-expire-articles): Ditto. + 2012-03-04 Thierry Volpiatto * gnus-msg.el (gnus-msg-mail): Call `message-mail' correctly when Gnus diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index f75ef37da..0c3346ac1 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -3643,6 +3643,10 @@ Uses the process/prefix convention." (expirable (if (gnus-group-total-expirable-p group) (cons nil (gnus-list-of-read-articles group)) (assq 'expire (gnus-info-marks info)))) + (articles-to-expire + (gnus-list-range-difference + (gnus-uncompress-sequence (cdr expirable)) + (cdr (assq 'unexist (gnus-info-marks info))))) (expiry-wait (gnus-group-find-parameter group 'expiry-wait)) (nnmail-expiry-target (or (gnus-group-find-parameter group 'expiry-target) @@ -3657,11 +3661,9 @@ Uses the process/prefix convention." ;; parameter. (let ((nnmail-expiry-wait-function nil) (nnmail-expiry-wait expiry-wait)) - (gnus-request-expire-articles - (gnus-uncompress-sequence (cdr expirable)) group)) + (gnus-request-expire-articles articles-to-expire group)) ;; Just expire using the normal expiry values. - (gnus-request-expire-articles - (gnus-uncompress-sequence (cdr expirable)) group)))) + (gnus-request-expire-articles articles-to-expire group)))) (gnus-close-group group)) (gnus-message 6 "Expiring articles in %s...done" (gnus-group-decoded-name group)) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 77bbe38d8..46e246f85 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -10304,16 +10304,19 @@ This will be the case if the article has both been mailed and posted." 'request-expire-articles gnus-newsgroup-name)) ;; This backend supports expiry. (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name)) - (expirable (if total - (progn - ;; We need to update the info for - ;; this group for `gnus-list-of-read-articles' - ;; to give us the right answer. - (gnus-run-hooks 'gnus-exit-group-hook) - (gnus-summary-update-info) - (gnus-list-of-read-articles gnus-newsgroup-name)) - (setq gnus-newsgroup-expirable - (sort gnus-newsgroup-expirable '<)))) + (expirable + (gnus-list-range-difference + (if total + (progn + ;; We need to update the info for + ;; this group for `gnus-list-of-read-articles' + ;; to give us the right answer. + (gnus-run-hooks 'gnus-exit-group-hook) + (gnus-summary-update-info) + (gnus-list-of-read-articles gnus-newsgroup-name)) + (setq gnus-newsgroup-expirable + (sort gnus-newsgroup-expirable '<))) + gnus-newsgroup-unexist)) (expiry-wait (if now 'immediate (gnus-group-find-parameter gnus-newsgroup-name 'expiry-wait))) -- 2.34.1