diff options
| author | Basil L. Contovounesios | 2018-05-01 16:05:52 +0100 |
|---|---|---|
| committer | Noam Postavsky | 2018-05-10 19:04:11 -0400 |
| commit | ae92f52c75383cf8f332db184d91f10fa8fb67cb (patch) | |
| tree | eac0588a88bf4e097f6c9a656a36496cef447b35 | |
| parent | d5cf1b3160a5510198fc5dd4e28b3eca7aadf71b (diff) | |
| download | emacs-ae92f52c75383cf8f332db184d91f10fa8fb67cb.tar.gz emacs-ae92f52c75383cf8f332db184d91f10fa8fb67cb.zip | |
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)
| -rw-r--r-- | lisp/window.el | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/lisp/window.el b/lisp/window.el index 8055e5babc0..bc2008e1d9c 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -8939,19 +8939,12 @@ For more details, see the documentation for `scroll-other-window'." | |||
| 8939 | Leave mark at previous position. | 8939 | Leave mark at previous position. |
| 8940 | With arg N, put point N/10 of the way from the true beginning." | 8940 | With arg N, put point N/10 of the way from the true beginning." |
| 8941 | (interactive "P") | 8941 | (interactive "P") |
| 8942 | (let ((orig-window (selected-window)) | 8942 | (with-selected-window (other-window-for-scrolling) |
| 8943 | (window (other-window-for-scrolling))) | 8943 | ;; Set point and mark in that window's buffer. |
| 8944 | ;; We use unwind-protect rather than save-window-excursion | 8944 | (with-no-warnings |
| 8945 | ;; because the latter would preserve the things we want to change. | 8945 | (beginning-of-buffer arg)) |
| 8946 | (unwind-protect | 8946 | ;; Set point accordingly. |
| 8947 | (progn | 8947 | (recenter '(t)))) |
| 8948 | (select-window window) | ||
| 8949 | ;; Set point and mark in that window's buffer. | ||
| 8950 | (with-no-warnings | ||
| 8951 | (beginning-of-buffer arg)) | ||
| 8952 | ;; Set point accordingly. | ||
| 8953 | (recenter '(t))) | ||
| 8954 | (select-window orig-window)))) | ||
| 8955 | 8948 | ||
| 8956 | (defun end-of-buffer-other-window (arg) | 8949 | (defun end-of-buffer-other-window (arg) |
| 8957 | "Move point to the end of the buffer in the other window. | 8950 | "Move point to the end of the buffer in the other window. |
| @@ -8959,15 +8952,10 @@ Leave mark at previous position. | |||
| 8959 | With arg N, put point N/10 of the way from the true end." | 8952 | With arg N, put point N/10 of the way from the true end." |
| 8960 | (interactive "P") | 8953 | (interactive "P") |
| 8961 | ;; See beginning-of-buffer-other-window for comments. | 8954 | ;; See beginning-of-buffer-other-window for comments. |
| 8962 | (let ((orig-window (selected-window)) | 8955 | (with-selected-window (other-window-for-scrolling) |
| 8963 | (window (other-window-for-scrolling))) | 8956 | (with-no-warnings |
| 8964 | (unwind-protect | 8957 | (end-of-buffer arg)) |
| 8965 | (progn | 8958 | (recenter '(t)))) |
| 8966 | (select-window window) | ||
| 8967 | (with-no-warnings | ||
| 8968 | (end-of-buffer arg)) | ||
| 8969 | (recenter '(t))) | ||
| 8970 | (select-window orig-window)))) | ||
| 8971 | 8959 | ||
| 8972 | (defvar mouse-autoselect-window-timer nil | 8960 | (defvar mouse-autoselect-window-timer nil |
| 8973 | "Timer used by delayed window autoselection.") | 8961 | "Timer used by delayed window autoselection.") |