changeset 8057:11a0c2f22d7e

(beginning-of-buffer-other-window) (end-of-buffer-other-window): New functions.
author Richard M. Stallman <rms@gnu.org>
date Sat, 25 Jun 1994 18:58:42 +0000
parents 1c5fd2cdfb36
children 671738c86a82
files lisp/simple.el
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sat Jun 25 18:20:55 1994 +0000
+++ b/lisp/simple.el	Sat Jun 25 18:58:42 1994 +0000
@@ -1705,6 +1705,39 @@
    (if (eq lines '-) nil
      (if (null lines) '-
        (- (prefix-numeric-value lines))))))
+
+(defun beginning-of-buffer-other-window (arg)
+  "Move point to the beginning of the buffer in the other window.
+Leave mark at previous position.
+With arg N, put point N/10 of the way from the true beginning."
+  (interactive "P")
+  (let ((orig-window (selected-window))
+	(window (other-window-for-scrolling)))
+    ;; We use unwind-protect rather than save-window-excursion
+    ;; because the latter would preserve the things we want to change.
+    (unwind-protect
+	(progn
+	  (select-window window)
+	  ;; Set point and mark in that window's buffer.
+	  (beginning-of-buffer arg)
+	  ;; Set point accordingly.
+	  (recenter '(t)))
+      (select-window orig-window))))
+
+(defun end-of-buffer-other-window (arg)
+  "Move point to the end of the buffer in the other window.
+Leave mark at previous position.
+With arg N, put point N/10 of the way from the true end."
+  (interactive "P")
+  ;; See beginning-of-buffer-other-window for comments.
+  (let ((orig-window (selected-window))
+	(window (other-window-for-scrolling)))
+    (unwind-protect
+	(progn
+	  (select-window window)
+	  (beginning-of-buffer arg)
+	  (recenter '(t)))
+      (select-window orig-window))))
 
 (defun transpose-chars (arg)
   "Interchange characters around point, moving forward one character.