Subject: Re: bug#11567: 24.0.97; WTF? ROFL! (hilarious bug)

From: Troels Nielsen <[email-masked]>
Date: Tue, 29 May 2012 00:49:20 +0200

> Then maybe we should use `quit-window' in the first place.  Attached
> find a patch for those who would give it a try (I hardly ever see the
> completions buffer).

Yes, it works nicely, as far as I can see when there is only one
frame. When anymore, the problem occurs just as before.

I suppose Stefan earlier hinted at something like this patch, which
together with your earlier simplification sort of fixes the problem.

Regards
Troels

=== modified file 'lisp/window.el'
--- lisp/window.el	2012-05-04 23:16:47 +0000
+++ lisp/window.el	2012-05-28 22:35:25 +0000
@@ -2371,7 +2371,10 @@ (defun window-deletable-p (&optional win
      ((frame-root-window-p window)
       ;; WINDOW's frame can be deleted only if there are other frames
       ;; on the same terminal.
-      (unless (eq frame (next-frame frame 0))
+      (unless (or (eq frame (next-frame frame 0))
+                  ;; Don't delete frame if its minibuffer is active.
+                  (let ((minibuf (active-minibuffer-window)))
+                    (and minibuf (eq frame (window-frame minibuf)))))
 	'frame))
      ((or ignore-window-parameters
 	  (not (eq (window-parameter window 'window-side) 'none))