]> code.delx.au - gnu-emacs/commitdiff
(dired-pop-to-buffer): Try to make this behave the
authorMartin Rudalics <rudalics@gmx.at>
Fri, 15 May 2009 15:00:32 +0000 (15:00 +0000)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 15 May 2009 15:00:32 +0000 (15:00 +0000)
Emacs 22 way (Bug#1806).

lisp/ChangeLog
lisp/dired.el

index 78f960f1172bebae342156e7e0c00092bb11e6c8..e7e011147c1e3b2584ea03309d7216b5bce6ea65 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-15  Martin Rudalics  <rudalics@gmx.at>
+
+       * dired.el (dired-pop-to-buffer): Try to make this behave the
+       Emacs 22 way (Bug#1806).
+
 2009-05-14  Chong Yidong  <cyd@stupidchicken.com>
 
        * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
index 087a05f3de42b4180e12a6969dcc9b896c2da559..0ccf4b128c4aa5871dd69f02a62f2cb1458d6ccc 100644 (file)
@@ -2686,8 +2686,14 @@ name, or the marker and a count of marked files."
 
 (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)
+  (let ((split-window-preferred-function
+        (lambda (window)
+          (or (and (window-splittable-p (selected-window))
+                   ;; Try to split the selected window vertically if
+                   ;; that's possible.  (Bug#1806)
+                   (split-window-vertically))
+              ;; Otherwise, try to split WINDOW sensibly.
+              (split-window-sensibly window)))))
     (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