bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51210: Customizable other-window-for-scrolling


From: Juri Linkov
Subject: bug#51210: Customizable other-window-for-scrolling
Date: Wed, 29 Dec 2021 19:31:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> Maybe like there is a variable other-window-scroll-buffer,
>> it would be nice to add a new user option
>> other-window-for-scrolling-function that will return
>> a window for scrolling.  It could provide a choise list that
>> includes a function that returns the most-recently-used window.
>
> Maybe a variable 'other-window-scroll-window' whose value could be a
> function to get that window.

Since there is already the word "window" in the function name,
maybe better would be 'other-window-scroll-default' that hints
that it overrides the default that is the next window:

diff --git a/src/window.c b/src/window.c
index e801ff821f..d06a706e58 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6307,10 +6307,12 @@ DEFUN ("other-window-for-scrolling", 
Fother_window_for_scrolling, Sother_window_
       if (NILP (window))
        window = display_buffer (Vother_window_scroll_buffer, Qt, Qnil);
     }
+  else if (FUNCTIONP (Vother_window_scroll_default))
+    /* Nothing specified; try to get a window from the function.  */
+    window = call0 (Vother_window_scroll_default);
   else
     {
-      /* Nothing specified; look for a neighboring window on the same
-        frame.  */
+      /* Otherwise, look for a neighboring window on the same frame.  */
       window = Fnext_window (selected_window, Qlambda, Qnil);
 
       if (EQ (window, selected_window))
@@ -8268,6 +8270,15 @@ syms_of_window (void)
               doc: /* If this is a live buffer, \\[scroll-other-window] should 
scroll its window.  */);
   Vother_window_scroll_buffer = Qnil;
 
+  DEFVAR_LISP ("other-window-scroll-default", Vother_window_scroll_default,
+              doc: /* Function that provides the window to scroll by 
\\[scroll-other-window].
+The function `other-window-for-scrolling' first tries to use
+`minibuffer-scroll-window' and `other-window-scroll-buffer'.
+But when both are nil, then by default it uses a neighboring window.
+This variable is intended to provide another default instead of
+a neighboring window.  */);
+  Vother_window_scroll_default = Qnil;
+
   DEFVAR_BOOL ("auto-window-vscroll", auto_window_vscroll_p,
               doc: /* Non-nil means to automatically adjust `window-vscroll' 
to view tall lines.  */);
   auto_window_vscroll_p = true;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]