aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-03-07 23:05:02 +0000
committerRichard M. Stallman2001-03-07 23:05:02 +0000
commit132bf46d745ddb3e8cdad1597d98f3105631f75a (patch)
tree0772e5cbaa016cba9b126b28817dfb4a6a5f332a
parent027568773d23c09eed32029a926e07783624f846 (diff)
downloademacs-132bf46d745ddb3e8cdad1597d98f3105631f75a.tar.gz
emacs-132bf46d745ddb3e8cdad1597d98f3105631f75a.zip
(rmail-toggle-header): Use a window which is showing the Rmail buffer,
rather than the selected window.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/mail/rmail.el39
2 files changed, 24 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d31f04579ff..7769ad1a701 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12001-03-07 Richard M. Stallman <rms@gnu.org> 12001-03-07 Richard M. Stallman <rms@gnu.org>
2 2
3 * info.el (Info-scroll-down): Fix previous change.
4
3 * mail/rmail.el (rmail-toggle-header): Use a window which 5 * mail/rmail.el (rmail-toggle-header): Use a window which
4 is showing the Rmail buffer, rather than the selected window. 6 is showing the Rmail buffer, rather than the selected window.
5 7
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."
1883 (if (eq pruned prune) 1883 (if (eq pruned prune)
1884 t 1884 t
1885 (rmail-maybe-set-message-counters) 1885 (rmail-maybe-set-message-counters)
1886 (let ((at-point-min (= (point) (point-min))) 1886 (let* ((window (get-buffer-window (current-buffer)))
1887 (all-headers-visible (= (window-start) (point-min))) 1887 (at-point-min (= (point) (point-min)))
1888 (on-header (save-excursion 1888 (all-headers-visible (= (window-start window) (point-min)))
1889 (and (not (search-backward "\n\n" nil t)) 1889 (on-header (save-excursion
1890 (progn 1890 (and (not (search-backward "\n\n" nil t))
1891 (end-of-line) 1891 (progn
1892 (re-search-backward "^[-A-Za-z0-9]+:" nil t)) 1892 (end-of-line)
1893 (match-string 0)))) 1893 (re-search-backward "^[-A-Za-z0-9]+:" nil t))
1894 (old-screen-line (rmail-count-screen-lines (window-start) (point)))) 1894 (match-string 0))))
1895 (old-screen-line
1896 (rmail-count-screen-lines (window-start window) (point))))
1895 (save-excursion 1897 (save-excursion
1896 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) 1898 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
1897 (if pruned 1899 (if pruned
@@ -1926,14 +1928,17 @@ otherwise, show it in full."
1926 (or (re-search-backward (concat "^" (regexp-quote on-header)) nil t) 1928 (or (re-search-backward (concat "^" (regexp-quote on-header)) nil t)
1927 (goto-char (point-min)))) 1929 (goto-char (point-min))))
1928 (t 1930 (t
1929 (recenter old-screen-line) 1931 (save-selected-window
1930 (if (and all-headers-visible 1932 (select-window window)
1931 (not (= (window-start) (point-min)))) 1933 (recenter old-screen-line)
1932 (let ((lines-offscreen (rmail-count-screen-lines 1934 (if (and all-headers-visible
1933 (point-min) (window-start)))) 1935 (not (= (window-start) (point-min))))
1934 (recenter (min (+ old-screen-line lines-offscreen) 1936 (let ((lines-offscreen (rmail-count-screen-lines
1935 ;; last line of window 1937 (point-min)
1936 (- (window-height) 2)))))))) 1938 (window-start window))))
1939 (recenter (min (+ old-screen-line lines-offscreen)
1940 ;; last line of window
1941 (- (window-height) 2))))))))))
1937 (rmail-highlight-headers)))) 1942 (rmail-highlight-headers))))
1938 1943
1939;; Lifted from repos-count-screen-lines. 1944;; Lifted from repos-count-screen-lines.