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

From: Juri Linkov <[email-masked]>
Date: Wed, 05 Oct 2011 02:55:30 +0300

> This bug is massive, unchanged for two years, and predates the Great
> Window-Handling Change. I cannot follow what the actual "bug" is here;
> it seems to have just turned into an extended general discussion.
>
> I don't think it is useful to keep this open, so I propose to close
> this, and ask people to open new bugs focused on whatever specific,
> individual issues remain.

Actually after Martin introduced a new variable `window-nest' it's
possible now to fix this bug in `dired-pop-to-buffer' where window space
for the *Marked Files* buffer is stolen from the wrong window in the
following configuration:

          ______________________________________
         | ____________________________________ |
         ||                                    ||
         ||                                    ||
         ||                                    ||
         ||                                    ||
         ||                                    ||
         ||                                    ||
         ||_________________W2_________________||
         | ____________________________________ |
         ||                                    ||
         ||                                    ||
         ||_________________W3_________________||
         |__________________W1__________________|

with the following simple patch:

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2011-09-18 20:43:20 +0000
+++ lisp/dired.el	2011-10-04 23:55:18 +0000
@@ -2873,7 +2873,8 @@ (defun dired-mark-prompt (arg files)
 
 (defun dired-pop-to-buffer (buf)
   "Pop up buffer BUF in a way suitable for Dired."
-  (let ((split-window-preferred-function
+  (let* ((window-nest t)
+	 (split-window-preferred-function
 	 (lambda (window)
 	   (or (and (let ((split-height-threshold 0))
 		      (window-splittable-p (selected-window)))

After fixing it this bug could be closed, and other possibilities
(e.g. to display this buffer above the minibuffer etc.) could be postponed
to 24.2 and discussed in a new feature request.