changeset 106238:8cb41d65f821

Really make the *Completions* window soft-dedicated (bug#5030). * window.el (window--display-buffer-2): Add `dedicated' argument. (display-buffer): Pass it when needed so the dedicated flag is set after calling set-window-buffer, which would otherwise reset it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Nov 2009 16:36:04 +0000
parents 7ddab4671153
children 0ac473df1bd1
files lisp/ChangeLog lisp/window.el
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Nov 25 16:19:51 2009 +0000
+++ b/lisp/ChangeLog	Wed Nov 25 16:36:04 2009 +0000
@@ -1,3 +1,10 @@
+2009-11-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	Really make the *Completions* window soft-dedicated (bug#5030).
+	* window.el (window--display-buffer-2): Add `dedicated' argument.
+	(display-buffer): Pass it when needed so the dedicated flag is set
+	after calling set-window-buffer, which would otherwise reset it.
+
 2009-11-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* progmodes/meta-mode.el (meta-complete-symbol):
--- a/lisp/window.el	Wed Nov 25 16:19:51 2009 +0000
+++ b/lisp/window.el	Wed Nov 25 16:36:04 2009 +0000
@@ -1035,11 +1035,14 @@
       (raise-frame frame))
     window))
 
-(defun window--display-buffer-2 (buffer window)
+(defun window--display-buffer-2 (buffer window &optional dedicated)
   "Display BUFFER in WINDOW and make its frame visible.
+Set `window-dedicated-p' to DEDICATED if non-nil.
 Return WINDOW."
   (when (and (buffer-live-p buffer) (window-live-p window))
     (set-window-buffer window buffer)
+    (when dedicated
+      (set-window-dedicated-p window-to-use dedicated))
     (window--display-buffer-1 window)))
 
 (defvar display-buffer-mark-dedicated nil
@@ -1139,9 +1142,7 @@
      ((or use-pop-up-frames (not frame-to-use))
       ;; We want or need a new frame.
       (let ((win (frame-selected-window (funcall pop-up-frame-function))))
-        (when display-buffer-mark-dedicated
-          (set-window-dedicated-p win display-buffer-mark-dedicated))
-        (window--display-buffer-2 buffer win)))
+        (window--display-buffer-2 buffer win display-buffer-mark-dedicated)))
      ((and pop-up-windows
 	   ;; Make a new window.
 	   (or (not (frame-parameter frame-to-use 'unsplittable))
@@ -1157,9 +1158,8 @@
 		      (get-largest-window frame-to-use t))
 		     (window--try-to-split-window
 		      (get-lru-window frame-to-use t)))))
-      (when display-buffer-mark-dedicated
-        (set-window-dedicated-p window-to-use display-buffer-mark-dedicated))
-      (window--display-buffer-2 buffer window-to-use))
+      (window--display-buffer-2 buffer window-to-use
+                                display-buffer-mark-dedicated))
      ((let ((window-to-undedicate
 	     ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate
 	     ;; the selected window to its buffer, to avoid that some of