1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-30 08:09:04 +00:00

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).
This commit is contained in:
Lars Ingebrigtsen 2022-05-01 12:47:31 +02:00
parent 8734d60b05
commit 730ad4a373
3 changed files with 27 additions and 32 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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);