]> git.eshelyaron.com Git - emacs.git/commitdiff
Adjust display-buffer-at-bottom.
authorMartin Rudalics <rudalics@gmx.at>
Fri, 29 Aug 2014 10:39:17 +0000 (12:39 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 29 Aug 2014 10:39:17 +0000 (12:39 +0200)
* window.el (display-buffer-at-bottom): Prefer bottom-left
window to other bottom windows.  Reuse a bottom window if it
shows the buffer already.  Suggested by Juri Linkov
<juri@jurta.org> in discussion of (Bug#18181).

lisp/ChangeLog
lisp/window.el

index 61fdfefb1851a1c9cfbaf6d3972443373012cd19..6df129d22ea0ec3a1f562751eeeb01a9aa3eff73 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-29  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (display-buffer-at-bottom): Prefer bottom-left
+       window to other bottom windows.  Reuse a bottom window if it
+       shows the buffer already.  Suggested by Juri Linkov
+       <juri@jurta.org> in discussion of (Bug#18181).
+
 2014-08-29  Leo Liu  <sdl.web@gmail.com>
 
        * files.el (minibuffer-with-setup-hook): Allow (:append FUN) to
index e159bd967f1f25474561c02ce66acd4ce670636a..539384c603d252c06879cbdb802cc9c47de5a2ce 100644 (file)
@@ -6469,13 +6469,26 @@ the selected one."
 
 (defun display-buffer-at-bottom (buffer alist)
   "Try displaying BUFFER in a window at the bottom of the selected frame.
-This either splits the window at the bottom of the frame or the
-frame's root window, or reuses an existing window at the bottom
-of the selected frame."
-  (let (bottom-window window)
+This either reuses such a window provided it shows BUFFER
+already, splits a window at the bottom of the frame or the
+frame's root window, or reuses some window at the bottom of the
+selected frame."
+  (let (bottom-window bottom-window-shows-buffer window)
     (walk-window-tree
-     (lambda (window) (setq bottom-window window)) nil nil 'nomini)
-    (or (and (not (frame-parameter nil 'unsplittable))
+     (lambda (window)
+       (cond
+       ((window-in-direction 'below window))
+       ((and (not bottom-window-shows-buffer)
+             (eq buffer (window-buffer window)))
+        (setq bottom-window-shows-buffer t)
+        (setq bottom-window window))
+       ((not bottom-window)
+        (setq bottom-window window)))
+       nil nil 'nomini))
+    (or (and bottom-window-shows-buffer
+            (window--display-buffer
+             buffer bottom-window 'reuse alist display-buffer-mark-dedicated))
+     (and (not (frame-parameter nil 'unsplittable))
             (let (split-width-threshold)
               (setq window (window--try-to-split-window bottom-window alist)))
             (window--display-buffer