diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-01 12:47:31 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-01 12:47:41 +0200 |
commit | 730ad4a3733203d24c9d0a8db6fde0aa087034ca (patch) | |
tree | b75f2f75155ea356a249700fa544d3f5518758c2 | |
parent | 8734d60b053852a6cf4dca59da4c5876820fa7d2 (diff) | |
download | emacs-730ad4a3733203d24c9d0a8db6fde0aa087034ca.tar.gz emacs-730ad4a3733203d24c9d0a8db6fde0aa087034ca.tar.bz2 emacs-730ad4a3733203d24c9d0a8db6fde0aa087034ca.zip |
Make scroll-other-window respect target window remappings
* lisp/window.el (scroll-other-window, scroll-other-window-down):
Moved from window.c and change implementation so that they respect
command remappings in the target window (bug#20236).
-rw-r--r-- | etc/NEWS | 9 | ||||
-rw-r--r-- | lisp/window.el | 18 | ||||
-rw-r--r-- | src/window.c | 32 |
3 files changed, 27 insertions, 32 deletions
@@ -587,6 +587,15 @@ available options can be restored by enabling this option. * Editing Changes in Emacs 29.1 --- +** 'scroll-other-window' and 'scroll-other-window-down' now respects remapping. +These commands (bound to 'C-M-v' and 'C-M-V') used to scroll the other +windows without looking a customizations in that other window. These +functions now check whether they have been rebound in the buffer in +that other window, and then call the remapped function instead. In +addition, these commands now also respect the +'scroll-error-top-bottom' user option. + +--- ** Indentation of 'cl-flet' and 'cl-labels' has changed. These forms now indent like this: diff --git a/lisp/window.el b/lisp/window.el index 5ceec77bd32..9f787846124 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -10093,6 +10093,24 @@ If ARG is the atom `-', scroll upward by nearly full screen." (put 'scroll-down-command 'scroll-command t) +(defun scroll-other-window (&optional lines) + "Scroll next window upward LINES lines; or near full screen if no ARG. +See `scroll-up-command' for details." + (interactive "P") + (with-selected-window (other-window-for-scrolling) + (funcall (or (command-remapping #'scroll-up-command) + #'scroll-up-command) + lines))) + +(defun scroll-other-window-down (&optional lines) + "Scroll next window downward LINES lines; or near full screen if no ARG. +See `scroll-down-command' for details." + (interactive "P") + (with-selected-window (other-window-for-scrolling) + (funcall (or (command-remapping #'scroll-down-command) + #'scroll-down-command) + lines))) + ;;; Scrolling commands which scroll a line instead of full screen. (defun scroll-up-line (&optional arg) diff --git a/src/window.c b/src/window.c index cfe3977428b..6d28384eeb7 100644 --- a/src/window.c +++ b/src/window.c @@ -6334,36 +6334,6 @@ followed by all visible frames on the current terminal. */) return window; } -DEFUN ("scroll-other-window", Fscroll_other_window, Sscroll_other_window, 0, 1, "P", - doc: /* Scroll next window upward ARG lines; or near full screen if no ARG. -A near full screen is `next-screen-context-lines' less than a full screen. -Negative ARG means scroll downward. If ARG is the atom `-', scroll -downward by nearly full screen. When calling from a program, supply -as argument a number, nil, or `-'. - -The next window is usually the one below the current one; -or the one at the top if the current one is at the bottom. -It is determined by the function `other-window-for-scrolling', -which see. - -Also see the `other-window-scroll-default' variable. */) - (Lisp_Object arg) -{ - specpdl_ref count = SPECPDL_INDEX (); - scroll_command (Fother_window_for_scrolling (), arg, 1); - return unbind_to (count, Qnil); -} - -DEFUN ("scroll-other-window-down", Fscroll_other_window_down, - Sscroll_other_window_down, 0, 1, "P", - doc: /* Scroll next window downward ARG lines; or near full screen if no ARG. -For more details, see the documentation for `scroll-other-window'. */) - (Lisp_Object arg) -{ - specpdl_ref count = SPECPDL_INDEX (); - scroll_command (Fother_window_for_scrolling (), arg, -1); - return unbind_to (count, Qnil); -} DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 2, "^P\np", doc: /* Scroll selected window display ARG columns left. @@ -8608,8 +8578,6 @@ displayed after a scrolling operation to be somewhat inaccurate. */); defsubr (&Sscroll_left); defsubr (&Sscroll_right); defsubr (&Sother_window_for_scrolling); - defsubr (&Sscroll_other_window); - defsubr (&Sscroll_other_window_down); defsubr (&Sminibuffer_selected_window); defsubr (&Srecenter); defsubr (&Swindow_text_width); |