How can I prevent Emacs resizing my windows?

You can remember your window configuration using the command M-x window-configuration-to-register (or C-x r w) at the beginning.

After you can always restore your configurations using M-x jump-to-register (or C-x r j).


winner-mode is a lifesaver, but to make pop-to-buffer not resize the window in the first place, do

(setq even-window-heights nil)

Unfortunately the main command pop-to-buffer, which is used by almost every program in emacs to switch to a buffer in a different window, has the side-effect you described.

In adition to all other solutions so far, there is a winner mode to undo/redo any changes in window configuration, at any moment of time.