Subject: bug#5030: 23.1.50; Unexpected minibuffer tab completion behavior

From: Matthew Dempsky <[email-masked]>
Date: Tue, 24 Nov 2009 17:23:05 -0800

On Tue, Nov 24, 2009 at 5:09 PM, Matthew Dempsky wrote:
>  - The `(and pop-up-windows ...)' clause of `display-buffer' is
> evaluated*, and calls `(set-window-dedicated-p window-to-use 'soft)'.
>  - However, the `window--display-buffer-2' call then calls
> `set-window-buffer', which sets `w->dedicated = Qnil'.

Not sure if this is the best fix, but the patch below at least
corrects this issue.  It changes `display-buffer' so that
`set-window-dedicated-p' is called after `window--display-buffer-2' in
both clauses that use `display-buffer-mark-dedicated'.

--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1139,9 +1139,9 @@ consider all visible or iconified frames."
      ((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)))
+	(prog1 (window--display-buffer-2 buffer win)
+	  (when display-buffer-mark-dedicated
+	    (set-window-dedicated-p win display-buffer-mark-dedicated)))))
      ((and pop-up-windows
 	   ;; Make a new window.
 	   (or (not (frame-parameter frame-to-use 'unsplittable))
@@ -1157,9 +1157,9 @@ consider all visible or iconified frames."
 		      (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))
+      (prog1 (window--display-buffer-2 buffer window-to-use)
+	(when display-buffer-mark-dedicated
+	  (set-window-dedicated-p 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