]> git.eshelyaron.com Git - emacs.git/commitdiff
(beginning-of-buffer-other-window)
authorRichard M. Stallman <rms@gnu.org>
Sat, 25 Jun 1994 18:58:42 +0000 (18:58 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 25 Jun 1994 18:58:42 +0000 (18:58 +0000)
(end-of-buffer-other-window): New functions.

lisp/simple.el

index 65742b68c6f351303cf0acdb61bbbf465a4b7b03..f87016aa4f775b9787dda1a9be550dc11a03ed83 100644 (file)
@@ -1705,6 +1705,39 @@ If this is zero, point is always centered after it moves off frame.")
    (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))))
 \f
 (defun transpose-chars (arg)
   "Interchange characters around point, moving forward one character.