9

After building a two column, 3 window layout with one tall column and two stacked equal sized shorter columns next to it, when I run commands like magit or ag that bring up a new buffer, often one of the shorter windows is resized so that it almost fills that column, and this leaves the other shorter window with just a hand full of lines left.

How can I always prevent emacs from resizing my windows after I've set them up? I've heard of winner mode, but it's less than ideal because 1) undoing the resize has the unfortunate side effect of also obscuring the buffer that I wanted to work with in the first place that triggered the resizing (ag or magit in my case), and 2) I would prefer emacs not to automatically resize frames in the first place.

Is there some configuration options that I can use to prevent emacs from ever resizing any of my windows, no matter what buffers it's trying to display?l

2 Answers 2

5

Try the folowing after the windows are set up:

(setq-default window-size-fixed t) 

The variable is buffer-local.

2
  • The problem is this is buffer-local, so I'd have to set it for every buffer I ever open. If I switch to a buffer without this variable set and do another ag search, then the windows get resized again. There has to be a way to prevent windows from resizing when new buffers get displayed. Commented Dec 25, 2017 at 6:53
  • 1
    @732 The variable is automatically buffer-local when set -- but as normally nothing sets it, just setting the default value works (did you try it??). It also quickly demonstrates a flaw in your request, which is that if you insist upon all existing windows retaining their current size you you lose the ability to split windows. Is that what you wanted? I suspect not. In which case your real question is a bit different / more complex. Commented Jun 27 at 1:47
0
(setq-default window-size-fixed t) (custom-set-faces '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight regular :height 90 :width normal))))) (setq-default window-size-fixed nil) 

This disables Emacs to resize its window when font changes. But resizing should be restored to avoid any problems.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.