Subject: bug#6385: A slightly less aggressive fit-window-to-buffer

From: martin rudalics <[email-masked]>
Date: Sun, 13 Jun 2010 09:51:34 +0200

> Can't we just throw in a better code instead of fit-window-to-buffer?
 > (And rename fit-window-to-buffer to killing-window-fit-to-buffer if
 > someone really wants it.)
 >
 > It does not have to be perfect. Just good enough. We can surely make
 > it better later if we need to.

I suppose there's no need for a `killing-window-fit-to-buffer'.  Writing
a non-killing one with Emacs 23 means can be done in a number of ways:

(1) Use `adjust-window-trailing-edge'.  IIRC that's what you already did
     when you wrote your window balancing algorithm so you know how to do
     that.

(2) Save the window configuration and the number of windows around the
     `enlarge-window' call in `fit-window-to-buffer' and restore the
     configuration when a window got deleted.  That's more or less what
     `adjust-window-trailing-edge' does internally.

(3) Adjust enlarge_window so it doesn't delete windows.

Since I don't understand enlarge_window any more I can't give you advice
on (3).  If you want to try (1) or (2) ask me if you encounter problems.

martin