changeset 36642:46b2ffce9799

(rmail-toggle-header): Use a window which is showing the Rmail buffer, rather than the selected window.
author Richard M. Stallman <rms@gnu.org>
date Wed, 07 Mar 2001 23:02:34 +0000
parents 5c29e09f5652
children 3231e1e742cf
files lisp/mail/rmail.el
diffstat 1 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Wed Mar 07 23:02:17 2001 +0000
+++ b/lisp/mail/rmail.el	Wed Mar 07 23:02:34 2001 +0000
@@ -1883,15 +1883,17 @@
     (if (eq pruned prune)
 	t
       (rmail-maybe-set-message-counters)
-      (let ((at-point-min (= (point) (point-min)))
-            (all-headers-visible (= (window-start) (point-min)))
-            (on-header (save-excursion
-                         (and (not (search-backward "\n\n" nil t))
-                              (progn
-                                (end-of-line)
-                                (re-search-backward "^[-A-Za-z0-9]+:" nil t))
-                              (match-string 0))))
-            (old-screen-line (rmail-count-screen-lines (window-start) (point))))
+      (let* ((window (get-buffer-window (current-buffer)))
+	     (at-point-min (= (point) (point-min)))
+	     (all-headers-visible (= (window-start window) (point-min)))
+	     (on-header (save-excursion
+			  (and (not (search-backward "\n\n" nil t))
+			       (progn
+				 (end-of-line)
+				 (re-search-backward "^[-A-Za-z0-9]+:" nil t))
+			       (match-string 0))))
+	     (old-screen-line
+	      (rmail-count-screen-lines (window-start window) (point))))
         (save-excursion
 	  (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
 	  (if pruned
@@ -1926,14 +1928,17 @@
 	       (or (re-search-backward (concat "^" (regexp-quote on-header)) nil t)
 		   (goto-char (point-min))))
 	      (t
-	       (recenter old-screen-line)
-	       (if (and all-headers-visible
-			(not (= (window-start) (point-min))))
-		   (let ((lines-offscreen (rmail-count-screen-lines
-					   (point-min) (window-start))))
-		     (recenter (min (+ old-screen-line lines-offscreen)
-				    ;; last line of window
-				    (- (window-height) 2))))))))
+	       (save-selected-window
+		 (select-window window)
+		 (recenter old-screen-line)
+		 (if (and all-headers-visible
+			  (not (= (window-start) (point-min))))
+		     (let ((lines-offscreen (rmail-count-screen-lines
+					     (point-min)
+					     (window-start window))))
+		       (recenter (min (+ old-screen-line lines-offscreen)
+				      ;; last line of window
+				      (- (window-height) 2))))))))))
       (rmail-highlight-headers))))
 
 ;; Lifted from repos-count-screen-lines.