I want emacs to always display new buffers in the current frame, but always taking the whole frame, rather than splitting it.

I currently have customized display-buffer-alist to the following

'(display-buffer-alist (quote ((".*" display-buffer-same-window))))

This seems to work in many cases (e.g. it works for C-x C-b) but not for all cases, most notably compile-goto-error, which still splits the frame.

I've looked at documentation and other questions, including the similar How can I block a frame from being split?, but I can't find a correct solution. In particular, that question uses display-buffer-reuse-window, while I'm pretty sure I want display-buffer-same-window, and also I want to have absolutely no exceptions.

Emacs version is 24.5

  • There is no 100% guarantee that modifying the display-buffer-alist will control all situations, especially if a window is dedicated. The guaranteed method is to look at the source code for each situation and deal with it. The compile.el library is frequently used in conjunction with other major-mode libraries, so you will need to look at both to see how displaying buffers are accomplished for a particular use-case situation. See also the split-width-threshold and split-height-threshold variables: gnu.org/software/emacs/manual/html_node/emacs/… – lawlist Sep 8 '15 at 21:27
  • In the event you have a dedicated window situation, it would be helpful to familiarize yourself with that section of the manual: gnu.org/software/emacs/manual/html_node/elisp/… – lawlist Sep 8 '15 at 21:28

As @lawlist said in a comment, you can use dedicated windows. A simple way to do this is to customize special-display-regexps to the list (.*), that is, a list with a regexp that matches all buffer names.

[Do not be bothered about the fact that help about special-display-regexps tells you that it is "obsolete since 24.3". It is super simple and works perfectly. I'd be lost without it. (Emacs tells you to just use the hypertrophied, steroidal display-buffer-alist instead. Good luck with that!)]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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