diff --git a/etc/NEWS b/etc/NEWS index fc7432669c3..88b4e59e267 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -586,6 +586,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);