7

I want to try a new workflow where split windows only happen if I request them, otherwise Emacs simply changes windows. I tried putting this command in my init.el:

(setq pop-up-windows nil)

And it seems to work mostly: if I use a help command, launch a compilation, use M-x occur, etc. Emacs correctly changes windows. However, in the *compilation* buffer, if I press RET on a line, Emacs splits the frame into two windows. Does anyone know what other configuration I need to make sure that Emacs properly switches?

gnuvince
  • 261
  • 1
  • 5
  • You would need to redefine several of the functions within `window.el`, including, but not limited to `display-buffer`. Doing that, however, will put you in for a world of future problems because most library authors go through a lot of planning in terms of which windows to display and ones to dedicate, and restoring prior window configurations. You're better off, in my opinion, only touching what specifically needs changing based on your personal preferences. In other words, use a scalpel or a laser knife instead of a machete (or Thor's War Hammer). – lawlist Dec 29 '14 at 07:40
  • This might be an advice rather than a direct answer. Forbid to split window maybe is not a good idea - some times it is quite useful. Quickly switch and close window may make your workflow fluent: Try [ace-window][1] and [ace-jump-mode][2], and get used to C-x 0 ;close current window C-x 1 ;close other windows [1]: https://github.com/abo-abo/ace-window [2]: https://github.com/winterTTr/ace-jump-mode These won't disappoint you. – Nick Dec 29 '14 at 14:19

1 Answers1

3

It's not super clear what behavior you're looking for.

If you want Emacs to either (1) replace the current buffer in the selected window or (2) show the new buffer in a new frame instead of a new window in the same frame, then consider using non-nil pop-up-frames.

In that case, you will likely want to make some additional changes, because Emacs development is quite biased toward windows instead of frames (e.g. some developments do not provide good support for using frames; some developments are not well tested with using frames instead of windows).

The Emacs Wiki pages about One-On-One Emacs provide information and code for this approach of favoring the use of frames over Emacs windows. Favoring means that you can always explicitly split a frame when you like, but Emacs doesn't do that, by default.

And library oneonone.el might prove useful for this approach.

Know too that you can make any window dedicated, which means that Emacs will never show a different buffer in it.

Basil
  • 12,019
  • 43
  • 69
Drew
  • 75,699
  • 9
  • 109
  • 225