From 3aef9604ce850fbbe44374835ebb4ad05b52a780 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 25 Jun 1994 18:58:42 +0000 Subject: [PATCH] (beginning-of-buffer-other-window) (end-of-buffer-other-window): New functions. --- lisp/simple.el | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lisp/simple.el b/lisp/simple.el index 65742b68c6f..f87016aa4f7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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)))) (defun transpose-chars (arg) "Interchange characters around point, moving forward one character. -- 2.39.5