Subject: Re: bug#1806: dired-pop-to-buffer in wrong place

From: martin rudalics <[email-masked]>
Date: Fri, 09 Jan 2009 10:30:10 +0100

>> Looking at this again, I believe what you want is to invert the order of
 >> stealing and giving as in the attached patch.  Might have side-effects
 >> elsewhere.
 >
 > Maybe a simpler solution

The change of `enlarge-window' _is_ simple - only the diff appears
complicated.  But we'd have to decide whether it's OK to steal from/give
to the previous window when enlarging a window.  (It makes a difference
only when we have at least three windows in a row or column.)

 > is to change `fit-window-to-buffer'
 > so in such configurations when windows are split vertically

We cannot change `fit-window-to-buffer' - it's used, for example, by
`resize-temp-buffer-window', not necessarily connected to splitting
windows at all.

 > (the correct treating of horizontally split windows
 > is already provided in dired-pop-to-buffer you sent recently)
 > it will temporarily switch the current window to the upper window
 > and call `enlarge-window' from the upper window, thus resizing
 > the right border.

We'd have to do this within the function that splits the Dired window.
I recently rewrote `fit-window-to-buffer' but still don't understand it
completely - in particular the (enlarge-window 1) loop.  Within that
loop we'd have to continuously switch to the Dired window in order too
enlarge it.  I'd rather avoid such hairy switches.

martin