I have searched in a number of places (1, 2, 3, 4) even looked at the e-lisp source files and could not figure out how to do, so I ask.
Context
I have bound next-error
to a key. I'm in some source code buffer and press the key. When walking to next error (compilation, grep, etc), emacs always makes sure to show the error buffer and the source code buffer.
What emacs does
The problem is, it insists in showing them in the same frame, splitting the current frame.
What I want
- Always show source code / grep match in the window which happens to be selected at the time
next-error
is run.- never split that window (customizing
split-*-threshold
is not enough) - if
next-error
brings to another source file, show it in current window, no split, no new frame (dedicated buffers don't seem to be enough).
- never split that window (customizing
- Regarding "compilation error"/"grep" buffer, if it is shown in any window, scroll to the appropriate line. Never split any window.
Accepted variants
Not to ask for more, but be more open to variations. For example, existing emacs logic may make some variants actually easier to implement:
- Similar to what ediff does when switching to next difference, if a frame currently shows the compilation/grep buffer, then putting that frame on top is acceptable.
- If no frame currently shows the compilation/grep, it is acceptable either to not show it, or to open a new frame showing it.
One possible implementation
- Just removing any attempt to split or make buffer visible would be acceptable.
How to do that?
M-: (set-frame-parameter nil 'unsplittable t)
. But that is attached to a particular frame, not change the generalnext-error
behavior.(lambda() (next-error) (delete-other-windows))