From: Richard M. Stallman Date: Wed, 7 Mar 2001 23:05:02 +0000 (+0000) Subject: (rmail-toggle-header): Use a window which is showing the Rmail buffer, X-Git-Tag: emacs-pretest-21.0.100~138 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=132bf46d745ddb3e8cdad1597d98f3105631f75a;p=emacs.git (rmail-toggle-header): Use a window which is showing the Rmail buffer, rather than the selected window. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d31f04579ff..7769ad1a701 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2001-03-07 Richard M. Stallman + * info.el (Info-scroll-down): Fix previous change. + * mail/rmail.el (rmail-toggle-header): Use a window which is showing the Rmail buffer, rather than the selected window. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 4909a4cb956..36a957e3637 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1883,15 +1883,17 @@ otherwise, show it in full." (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 @@ otherwise, show it in full." (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.