1

According to the documentation of other-window-for-scrolling we should be able to specify the "other window" by setting the variable other-window-scroll-buffer:

other-window-for-scrolling is a built-in function in ‘src/window.c’.

(other-window-for-scrolling)

Return the other window for "other window scroll" commands. If in the minibuffer, ‘minibuffer-scroll-window’ if non-nil specifies the window. Otherwise, if ‘other-window-scroll-buffer’ is non-nil, a window showing that buffer is used, popping the buffer up if necessary. Finally, look for a neighboring window on the selected frame, followed by all visible frames on the current terminal.

However, in reality this seems to be ignored:

(setq other-window-scroll-buffer "*R*")

(other-window-for-scrolling) --> #<window 558 on header.html>

Is this a bug or feature that was removed?

1 Answer 1

1

The doc for other-window-scroll-buffer says:

If this is a live buffer, C-M-v should scroll its window.

(emphasis added). IOW, the value must be a buffer, not the name of a buffer. So try:

(setq other-window-scroll-buffer (get-buffer "*R*"))

get-buffer is a function that returns a buffer, given its name (a string). If no such buffer exists, it returns nil. See its doc string with C-h f get-buffer.

4
  • I tried this and did not work for me. Did it work for you?
    – FKG
    Mar 6, 2023 at 18:56
  • Yes, it did: do you have a live buffer called *R*? In my case, I set my shell buffer to be the scrolling buffer and other-window-for-scrolling returns it (and makes it visible in a window if it is not visible to begin with) and C-M-v scrolls it (and also makes it visible if necessary).
    – NickD
    Mar 6, 2023 at 19:33
  • yes it works. I had the wrong name it is suppose to be:other-window-scroll-buffer not other-window-scrolling-buffer. Thanks
    – FKG
    Mar 6, 2023 at 19:44
  • That's my fault: I screwed up the spelling of the variable and instead of cutting and pasting the code, I retyped it getting it wrong in the process. Apologies and thanks. I fixed up the answer.
    – NickD
    Mar 6, 2023 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.