summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-11-20 15:01:14 +0000
committerRichard M. Stallman <rms@gnu.org>1994-11-20 15:01:14 +0000
commit8ea3c7b02361d91196c30603ff9a8f7967f3c3f6 (patch)
tree6a9bd0d7e059612a0473a574010d03a25220dbd8 /lisp/mail
parentb13ee6a2ef6c4f12f1029a39364529596186310c (diff)
downloademacs-8ea3c7b02361d91196c30603ff9a8f7967f3c3f6.tar.gz
(rmail-summary-scroll-msg-up): If at end of message,
advance to the next message. (rmail-summary-scroll-msg-down): If at beginning of message, advance to the previous message.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/rmailsum.el57
1 files changed, 45 insertions, 12 deletions
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index c982c058c78..e2c684d85bd 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -864,22 +864,55 @@ Commands for sorting the summary:
(set-buffer obuf))))))
(defun rmail-summary-scroll-msg-up (&optional dist)
- "Scroll the Rmail window forward."
+ "Scroll the Rmail window forward.
+If the Rmail window is displaying the end of a message,
+advance to the next message."
(interactive "P")
- (let ((other-window-scroll-buffer rmail-buffer))
- (if (get-buffer-window rmail-buffer)
- (scroll-other-window dist)
- ;; This forces rmail-buffer to be sized correctly later.
- (display-buffer rmail-buffer)
- (setq rmail-current-message nil))))
+ (if (eq dist '-)
+ (rmail-summary-scroll-msg-down nil)
+ (let ((rmail-buffer-window (get-buffer-window rmail-buffer)))
+ (if rmail-buffer-window
+ (if (let ((rmail-summary-window (selected-window)))
+ (select-window rmail-buffer-window)
+ (prog1
+ ;; Is EOB visible in the buffer?
+ (save-excursion
+ (let ((ht (window-height (selected-window))))
+ (move-to-window-line (- ht 2))
+ (end-of-line)
+ (eobp)))
+ (select-window rmail-summary-window)))
+ (rmail-summary-next-msg (or dist 1))
+ (let ((other-window-scroll-buffer rmail-buffer))
+ (scroll-other-window dist)))
+ ;; This forces rmail-buffer to be sized correctly later.
+ (display-buffer rmail-buffer)
+ (setq rmail-current-message nil)))))
(defun rmail-summary-scroll-msg-down (&optional dist)
- "Scroll the Rmail window backward."
+ "Scroll the Rmail window backward.
+If the Rmail window is displaying the beginning of a message,
+advance to the previous message."
(interactive "P")
- (rmail-summary-scroll-msg-up
- (cond ((eq dist '-) nil)
- ((null dist) '-)
- (t (- (prefix-numeric-value dist))))))
+ (if (eq dist '-)
+ (rmail-summary-scroll-msg-up nil)
+ (let ((rmail-buffer-window (get-buffer-window rmail-buffer)))
+ (if rmail-buffer-window
+ (if (let ((rmail-summary-window (selected-window)))
+ (select-window rmail-buffer-window)
+ (prog1
+ ;; Is BOB visible in the buffer?
+ (save-excursion
+ (move-to-window-line 0)
+ (beginning-of-line)
+ (bobp))
+ (select-window rmail-summary-window)))
+ (rmail-summary-previous-msg (or dist 1))
+ (let ((other-window-scroll-buffer rmail-buffer))
+ (scroll-other-window-down dist)))
+ ;; This forces rmail-buffer to be sized correctly later.
+ (display-buffer rmail-buffer)
+ (setq rmail-current-message nil)))))
(defun rmail-summary-beginning-of-message ()
"Show current message from the beginning."