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

From: martin rudalics <[email-masked]>
Date: Fri, 16 Jan 2009 15:52:17 +0100

>     +------------+------------+
 >     |            |            |
 >     |            |            |
 >     |   dired    |   other    |
 >     |            |            |
 >     |            |            |
 >     +------------+            |
 >     |   other    |            |
 >     |            |            |
 >     +------------+------------+
 >     | file1.ext file2.ext     |
 >     | file3.ext file4.ext     |
 >     +-------------------------+
 >     | Prompt: command         |
 >     +-------------------------+
 >
 > I think this would be the best layout, but not sure is it possible
 > to create it using splitting from the initial configuration?

Not really.  Creating windows anew breaks the 'window property of
overlays.  ISTR that Lennart has some code to fix that, but the overhead
may be considerable since you have to investigate all overlays and most
of them usually don't have the 'window property.  Here I simply split
the root window to get the effect you mean.  In any case, restoring the
previous configuration when the window is no more needed is not entirely
trivial either.

I suppose, for the moment we have to split the "other" window below
instead.  That is, check if there is a window with the same left edge as
the dired window and the maximum bottom edge of all windows on this
frame.  If that window cannot be split because it's too small or fixed
height, try to split the selected window (the dired window) instead.

martin