[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ae92f52 3/4: Simplify "other window" bob/eob motion
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master ae92f52 3/4: Simplify "other window" bob/eob motion commands |
Date: |
Thu, 10 May 2018 19:47:52 -0400 (EDT) |
branch: master
commit ae92f52c75383cf8f332db184d91f10fa8fb67cb
Author: Basil L. Contovounesios <address@hidden>
Commit: Noam Postavsky <address@hidden>
Simplify "other window" bob/eob motion commands
* lisp/window.el (beginning-of-buffer-other-window)
(end-of-buffer-other-window):
Simplify via with-selected-window. (bug#30207)
---
lisp/window.el | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/lisp/window.el b/lisp/window.el
index 8055e5b..bc2008e 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8939,19 +8939,12 @@ For more details, see the documentation for
`scroll-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.
- (with-no-warnings
- (beginning-of-buffer arg))
- ;; Set point accordingly.
- (recenter '(t)))
- (select-window orig-window))))
+ (with-selected-window (other-window-for-scrolling)
+ ;; Set point and mark in that window's buffer.
+ (with-no-warnings
+ (beginning-of-buffer arg))
+ ;; Set point accordingly.
+ (recenter '(t))))
(defun end-of-buffer-other-window (arg)
"Move point to the end of the buffer in the other window.
@@ -8959,15 +8952,10 @@ 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)
- (with-no-warnings
- (end-of-buffer arg))
- (recenter '(t)))
- (select-window orig-window))))
+ (with-selected-window (other-window-for-scrolling)
+ (with-no-warnings
+ (end-of-buffer arg))
+ (recenter '(t))))
(defvar mouse-autoselect-window-timer nil
"Timer used by delayed window autoselection.")