changeset 100290:eb90f68074a8

(pmail-only-expunge): Swap buffers at the beginning.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 09 Dec 2008 19:35:06 +0000
parents 69c56e35242e
children c9bb16a15af4
files lisp/mail/pmail.el
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/pmail.el	Tue Dec 09 19:35:00 2008 +0000
+++ b/lisp/mail/pmail.el	Tue Dec 09 19:35:06 2008 +0000
@@ -3491,6 +3491,7 @@
 (defun pmail-only-expunge (&optional dont-show)
   "Actually erase all deleted messages in the file."
   (interactive)
+  (pmail-swap-buffers-maybe)
   (set-buffer pmail-buffer)
   (message "Expunging deleted messages...")
   ;; Discard all undo records for this buffer.
@@ -3517,12 +3518,11 @@
 	  (goto-char (point-min))
 	  (let ((counter 0)
 		(number 1)
+		new-summary
+		(new-msgref (list (list 0)))
+		(buffer-read-only nil)
 		(total pmail-total-messages)
 		(new-message-number pmail-current-message)
-		(new-summary nil)
-		(new-msgref (list (list 0)))
-		(pmailbuf (current-buffer))
-		(buffer-read-only nil)
 		(messages pmail-message-vector)
 		(deleted pmail-deleted-vector)
 		(summary pmail-summary-vector))
@@ -3535,9 +3535,8 @@
 	    (while (<= number total)
 	      (if (= (aref deleted number) ?D)
 		  (progn
-		    (delete-region
-		      (marker-position (aref messages number))
-		      (marker-position (aref messages (1+ number))))
+		    (delete-region (aref messages number)
+				   (aref messages (1+ number)))
 		    (move-marker (aref messages number) nil)
 		    (if (> new-message-number counter)
 			(setq new-message-number (1- new-message-number))))
@@ -3569,7 +3568,6 @@
 	  (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)))
       (if (not dont-show)
 	  (pmail-show-message-maybe (min pmail-current-message pmail-total-messages)))
-      (pmail-swap-buffers-maybe)
       (if pmail-enable-mime
 	  (goto-char (+ (point-min) opoint))
 	(goto-char (+ (point) opoint))))))