Prevent Emacs switch-to-buffer-other-window From Resizing Other Window
I often have split windows in a frame where one is much smaller than the other (usually done through C-u C-u C-x ^). This is so I can see some snippet of code as reference while doing something else.
The problem is: when I use C-x 4 b to switch to some ot开发者_C百科her buffer (or C-x 4 f to open a new file in the lower window), the lower window is resized to its original half-the-frame height size. Is there a way to stop that from happening and keep my smaller window size?
If you evaluate (setq even-window-heights nil)
before running C-x 4 f (or a similar command), Emacs won't try to balance the heights of your windows. Here's the documentation for even-window-heights
:
If non-nil display-buffer will try to even window heights.
Otherwise display-buffer will leave the window configuration
alone. Heights are evened only when display-buffer chooses a
window that appears above or below the selected window.
I recommend writing a small elisp function that sets this variable to nil and then calls switch-to-buffer-other-window
or find-file-other-window
, since it's probably something that you'll want to do frequently.
C-x 4 b
isn't really a nav command. Do you still have the problem if you C-x b
or simply C-x o
?
精彩评论