]> git.eshelyaron.com Git - emacs.git/commitdiff
(display-buffer): When a buffer is displayed in the
authorMartin Rudalics <rudalics@gmx.at>
Sun, 4 Jan 2009 19:03:09 +0000 (19:03 +0000)
committerMartin Rudalics <rudalics@gmx.at>
Sun, 4 Jan 2009 19:03:09 +0000 (19:03 +0000)
selected and some other window, and not-this-window is non-nil,
try to return that other window instead of popping up a new
frame.  (Bug#30)

lisp/ChangeLog
lisp/window.el

index 08ee4028c595f180d2227a2f8edb22271bf4ccf9..5841f1f068089b6a0ba38047bf9ac46c2d3bf7d6 100644 (file)
@@ -1,3 +1,10 @@
+2009-01-04  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (display-buffer): When a buffer is displayed in the
+       selected and some other window, and not-this-window is non-nil,
+       try to return that other window instead of popping up a new
+       frame.  (Bug#30)
+
 2009-01-04  Chong Yidong  <cyd@stupidchicken.com>
 
        * simple.el (visual-line-mode-map): Remove M-[ and M-] bindings.
index 53ec4a665db6b5c7996515d21000d9664fb24010..b43eee2f9fef359b3d8f87d4deb0c381af3fdf0e 100644 (file)
@@ -1006,10 +1006,16 @@ consider all visible or iconified frames."
                                 (not (last-nonminibuffer-frame)))
                             0)
                        (last-nonminibuffer-frame))))
-       (and (setq window-to-use (get-buffer-window buffer frames))
-            (or can-use-selected-window
-                (not (eq (selected-window) window-to-use)))))
-      ;; If the buffer is already displayed in some window use that.
+       (setq window-to-use
+             (catch 'found
+               ;; Search all visible and iconified frames for a window
+               ;; displaying BUFFER.  Return the selected window only
+               ;; if can-use-selected-window says we may do so.
+               (dolist (window (get-buffer-window-list buffer 'nomini 0))
+                 (when (or can-use-selected-window
+                           (not (eq (selected-window) window)))
+                   (throw 'found window))))))
+      ;; The buffer is already displayed in some window; use that.
       (window--display-buffer-1 window-to-use))
      ((and special-display-function
           ;; `special-display-p' returns either t or a list of frame