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

From: Lennart Borgman <[email-masked]>
Date: Sun, 13 Jun 2010 17:23:51 +0200

On Sun, Jun 13, 2010 at 9:51 AM, martin rudalics <[email-masked]> wrote:
>> 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.

Thanks. Writing the code is probably not a big problem, keeping
another patch in my patched Emacs is. So I will write a new version
and send it here. (I wonder if I had not written it already and threw
it away to avoid keeping another patch.)