changeset 3461:1dec1449324d

(rmail-summary-expunge-and-save): Call set-buffer again after rmail-only-expunge. (rmail-summary-add-label, rmail-summary-kill-label): Fix reading the label. (rmail-summary-rmail-update): Bind window locally. Use unwind-protect, not save-window-excursion.
author Richard M. Stallman <rms@gnu.org>
date Thu, 03 Jun 1993 21:02:10 +0000
parents 9943fb1c45ca
children 2624c18df764
files lisp/mail/rmailsum.el
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmailsum.el	Thu Jun 03 20:43:29 1993 +0000
+++ b/lisp/mail/rmailsum.el	Thu Jun 03 21:02:10 1993 +0000
@@ -522,16 +522,20 @@
 	    (skip-chars-forward "0-9")
 	    (setq msg-num (string-to-int (buffer-substring beg (point))))
 	    (or (eq rmail-current-message msg-num)
-		(progn
+		(let (go-where window (owin (selected-window)))
 		  (setq rmail-current-message msg-num)
 		  (if (= (following-char) ?-)
 		      (progn
 			(delete-char 1)
 			(insert " ")))
 		  (setq window (display-buffer rmail-buffer))
-		  (save-window-excursion
-		    (select-window window)
-		    (rmail-show-message msg-num)))))))))
+		  ;; Using save-window-excursion caused the new value
+		  ;; of point to get lost.
+		  (unwind-protect
+		      (progn
+			(select-window window)
+			(rmail-show-message msg-num))
+		    (select-window owin)))))))))
 
 (defvar rmail-summary-mode-map nil)
 
@@ -674,6 +678,7 @@
   (save-excursion
     (set-buffer rmail-buffer)
     (rmail-only-expunge)
+    (set-buffer rmail-buffer)
     (save-buffer))
   (rmail-update-summary))
 
@@ -682,8 +687,7 @@
   (interactive)
   (save-excursion
     (set-buffer rmail-buffer)
-    (rmail-get-new-mail))
-  (rmail-update-summary))
+    (rmail-get-new-mail)))
 
 (defun rmail-summary-input (filename)
   "Run Rmail on file FILENAME."
@@ -767,7 +771,9 @@
 (defun rmail-summary-add-label (label)
   "Add LABEL to labels associated with current Rmail message.
 Completion is performed over known labels when reading."
-  (interactive (list (rmail-read-label "Add label")))
+  (interactive (list (save-excursion
+		       (set-buffer rmail-buffer)
+		       (rmail-read-label "Add label"))))
   (save-excursion
     (set-buffer rmail-buffer)
     (rmail-add-label label)))
@@ -775,7 +781,9 @@
 (defun rmail-summary-kill-label (label)
   "Remove LABEL from labels associated with current Rmail message.
 Completion is performed over known labels when reading."
-  (interactive (list (rmail-read-label "Add label")))
+  (interactive (list (save-excursion
+		       (set-buffer rmail-buffer)
+		       (rmail-read-label "Kill label"))))
   (save-excursion
     (set-buffer rmail-buffer)
     (rmail-set-label label nil)))