Specify which window to use as "other"
There are several useful function that allows one to scroll another window without changing to that window, for example, M-C-v
and M-C-S-v
. The problem is that when you have more that 2 windows it is not very helpful since the other window
may not be the windows you want to scroll.
See:
The following function allows you to select which of the windows in the current frame you want to use as other window
. Simple call the interactive function set-other-window
and select which windows should be treated as the other window.
You can go back the the previous behavior with the function automatic-other-window-selection
(defun set-other-window-func(&optional arg)
"set the other window"
(unless arg (setq arg nil))
(message "arg=%s" arg)
(if arg
(setq other-window-scroll-buffer
(get-buffer arg))
(progn
(let*
((window_names (mapcar (lambda (w) (buffer-name (window-buffer w)))
(window-list)))
(cwindow (list (buffer-name (window-buffer))))
(windows_names_filt (cl-set-difference window_names cwindow))
)
(progn
(message "windows_names_filt: %s" windows_names_filt)
(setq other-window-scroll-buffer
(get-buffer (completing-read "Select other window: " windows_names_filt)))
)
)
)
)
)
(defun set-other-window()
"set other windows to selected window"
(interactive)
(set-other-window-func)
)
(defun automatic-other-window-selection()
"Return the default behavior of other window"
(interactive)
(setq other-window-scroll-buffer nil)
)
see: