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

From: Juri Linkov <[email-masked]>
Date: Sat, 02 May 2009 14:48:57 +0300

>   (defun dired-pop-to-buffer (buf)
>     "Pop up buffer BUF in a way suitable for Dired."
> !   ;; Don't split window horizontally.  (Bug#1806)
> !   (let (split-width-threshold)
> !     (pop-to-buffer (get-buffer-create buf)))
>     ;; If dired-shrink-to-fit is t, make its window fit its contents.
>     (when dired-shrink-to-fit
>       ;; Try to not delete window when we want to display less than
> --- 2686,2696 ----
>   
>   (defun dired-pop-to-buffer (buf)
>     "Pop up buffer BUF in a way suitable for Dired."
> !   (lexical-let ((old-fun split-window-preferred-function)
> ! 		(old-window (selected-window)))
> !     (let ((split-window-preferred-function
> ! 	   (lambda () (with-selected-window old-window (funcall old-fun)))))
> !       (pop-to-buffer (get-buffer-create buf))))
>     ;; If dired-shrink-to-fit is t, make its window fit its contents.
>     (when dired-shrink-to-fit
>       ;; Try to not delete window when we want to display less than

Is your patch intended to fix a problem I reported?  I tried it and
it makes the current state worse.  It works incorrectly even in the
one-window configuration - it splits it horizontally and displays
a list of files in a side window.

However, when I replaced

  (funcall old-fun)

with

  (funcall 'split-window-vertically)

in your patch, it works perfectly in all configurations I tried.

-- 
Juri Linkov
http://www.jurta.org/emacs/