summaryrefslogtreecommitdiff
path: root/lisp/mail/pmail.el
diff options
context:
space:
mode:
authorPaul Reilly <pmr@pajato.com>2008-09-01 08:35:24 +0000
committerPaul Reilly <pmr@pajato.com>2008-09-01 08:35:24 +0000
commite87ae05bed24cd611de98c470f043324a30e56cc (patch)
tree51053edd6be37c45513bd7b3b6efe766a5948bde /lisp/mail/pmail.el
parentd007e8e938ac11e9e37ab248292caa99e1c719aa (diff)
downloademacs-e87ae05bed24cd611de98c470f043324a30e56cc.tar.gz
emacs-e87ae05bed24cd611de98c470f043324a30e56cc.tar.bz2
emacs-e87ae05bed24cd611de98c470f043324a30e56cc.zip
Fix the expunge operation.
pmail.el (pmail-only-expunge): Manage pmail-total-messages in the callback handler; remove the extra show message call. (pmail-expunge-callback): Rewrite to handle all possible conditions. pmaildesc.el (pmail-desc-get-previous, pmail-desc-get-match-index): New functions.
Diffstat (limited to 'lisp/mail/pmail.el')
-rw-r--r--lisp/mail/pmail.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/mail/pmail.el b/lisp/mail/pmail.el
index 09ec42d13e3..72abe896fbc 100644
--- a/lisp/mail/pmail.el
+++ b/lisp/mail/pmail.el
@@ -2622,10 +2622,8 @@ See also user-option `pmail-confirm-expunge'."
;; Remove the messages from the buffer and from the Pmail message
;; descriptor vector.
(pmail-desc-prune-deleted-messages 'pmail-expunge-callback)
- ;; Update the Pmail message counter, deal with the summary buffer,
- ;; show the current message and update the User status.
- (setq pmail-total-messages (pmail-desc-get-count))
- (pmail-show-message pmail-current-message t)
+ ;; Deal with the summary buffer and update
+ ;; the User status.
(let* ((omax (- (buffer-size) (point-max)))
(omin (- (buffer-size) (point-min)))
(opoint (if (and (> pmail-current-message 0)
@@ -2650,8 +2648,15 @@ See also user-option `pmail-confirm-expunge'."
(defun pmail-expunge-callback (n)
"Called after message N has been pruned to update the current Pmail
message counter."
- (if (< n pmail-current-message)
- (setq pmail-current-message (1- pmail-current-message))))
+ ;; Process the various possible states to set the current message
+ ;; counter.
+ (setq pmail-total-messages (1- pmail-total-messages)
+ pmail-current-message
+ (cond
+ ((= 0 pmail-total-messages) 0)
+ ((> pmail-current-message n) (pmail-desc-get-previous pmail-desc-deleted-index n))
+ ((> pmail-current-message n) 0)
+ (t pmail-current-message))))
;;; mbox: ready
(defun pmail-expunge ()