Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs 23.2 opens a new window for each compile error/warning navigated to

Tags:

emacs

elisp

I've recently upgraded from Carbon Emacs (v22.3) to vanilla Emacs 23.2 (from http://www.emacsformacosx.com). On Carbon Emacs when compiling a project, The frame is split in two with the current source file/SConscript in the top window, and the compile output in the bottom window. I'd hit C-x ` to navigate to the first warning or error in the compile output and it would replace whatever was in the top window with the source file the error or warning is in.

In Emacs 23.2, however, a 3rd window is opened causing two windows open in the top half of the frame (split vertically) and the compile output in the window of the bottom half of the frame. How do I tell Emacs to not open a new window and instead open the code in the the existing non-compiler output window in the frame?


A little further clarification on the behavior that I just noticed. If I hit C-x ` while the buffer containing the source file or SConscript file is active, no new window is opened. It's only if I'm manually navigating through the *compilation* buffer and hitting enter on an error or warning, or mouse clicking on a warning when a third buffer window appears.

like image 375
Grant Limberg Avatar asked May 11 '10 18:05

Grant Limberg


2 Answers

The function which is used in next-error functionality is pop-to-buffer which in turn uses split-window-sensibly. You can control the behavior of split-window-sensibly by adjusting the variables split-width-threshold and split-height-threshold.

In your case it is split-width-threshold which is too small. In my emacs 23.1 it is set to 160. Just set it to a larger number and the problem should be solved:

(setq split-width-threshold 200)
like image 181
VitoshKa Avatar answered Oct 19 '22 07:10

VitoshKa


I can't reproduce this problem myself, but you might try the following:

(setq split-width-threshold nil)

This tells display-buffer never to split windows horizontally, even if they are quite wide. There is also a split-height-threshold variable which is handled similarly. Checking these variables' current values might suggest whether they could be relevant to the behavior you're seeing.

One last thing to check: if you have defined your own display-buffer-function, that could be making these decisions for you.

like image 2
Jim Blandy Avatar answered Oct 19 '22 08:10

Jim Blandy