diff --git a/lisp/frame.el b/lisp/frame.el index cec2624..8dad63f 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -123,8 +123,6 @@ handle-delete-frame ;; not a child frame. (when (and (not (eq frame-1 frame)) (frame-visible-p frame-1) - (window-live-p (minibuffer-window frame-1)) - (eq (window-frame (minibuffer-window frame-1)) frame-1) (not (frame-parent frame-1)) (not (frame-parameter frame-1 'delete-before))) (throw 'other-frame t)))) diff --git a/src/frame.c b/src/frame.c index 681a245..b108e45 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1560,15 +1560,16 @@ of them (the selected terminal frame) is actually displayed. * Return true if there exists at least one visible or iconified frame * but F. Return false otherwise. * - * Always return false when all remaining frames are either tooltip or - * child frames or frames with a non-nil `delete-before' parameter. If - * INVISIBLE is false, also return false when the minibuffer window of - * all remaining frames is on F. - + * INVISIBLE true means we are called from make_frame_invisible where + * such a frame must be visible or iconified. INVISIBLE nil means we + * are called from delete_frame. In that case FORCE true means that the + * visibility status of such a frame can be ignored. + * * If F is the terminal frame and we are using X, return true if at - * least one X frame exists. */ + * least one X frame exists. + */ static bool -other_frames (struct frame *f, bool invisible) +other_frames (struct frame *f, bool invisible, bool force) { Lisp_Object frames, frame, frame1; struct frame *f1; @@ -1591,23 +1592,20 @@ of them (the selected terminal frame) is actually displayed. x_sync (f1); #endif if (NILP (Fframe_parameter (frame1, Qtooltip)) - /* Tooltips and child frames don't count. */ + /* Tooltips and child frames count neither for + invisibility nor for deletions. */ && !FRAME_PARENT_FRAME (f1) /* Frames with a non-nil `delete-before' parameter don't - count - either they depend on us or they depend on a - frame that we will have to find right here. */ - && NILP (get_frame_param (f1, Qdelete_before)) - /* Frames whose minibuffer window is on F don't count - unless INVISIBLE is set - in that case F is either made - invisible and may be autoraised from such a frame or - the FORCE argument of delete_frame was non-nil. */ - && (invisible || NILP (minibuffer_window) - || !EQ (FRAME_MINIBUF_WINDOW (f1), minibuffer_window)) - /* At least one visible/iconified frame must remain. */ + count for deletions. */ + && (invisible || NILP (get_frame_param (f1, Qdelete_before))) + /* For invisibility and normal deletions, at least one + visible or iconified frame must remain (Bug#26682). */ && (FRAME_VISIBLE_P (f1) || FRAME_ICONIFIED_P (f1) - /* Allow deleting the terminal frame when at least one - X frame exists. */ - || (FRAME_WINDOW_P (f1) && !FRAME_WINDOW_P (f)))) + || (!invisible + && (force + /* Allow deleting the terminal frame when at + least one X frame exists. */ + || (FRAME_WINDOW_P (f1) && !FRAME_WINDOW_P (f)))))) return true; } } @@ -1680,7 +1678,7 @@ of them (the selected terminal frame) is actually displayed. if (!FRAME_LIVE_P (f)) return Qnil; - else if (!EQ (force, Qnoelisp) && !other_frames (f, !NILP (force))) + else if (!EQ (force, Qnoelisp) && !other_frames (f, false, true)) { if (NILP (force)) error ("Attempt to delete the sole visible or iconified frame"); @@ -1752,7 +1750,7 @@ of them (the selected terminal frame) is actually displayed. one. */ if (!FRAME_LIVE_P (f)) return Qnil; - else if (!EQ (force, Qnoelisp) && !other_frames (f, !NILP (force))) + else if (!EQ (force, Qnoelisp) && !other_frames (f, false, true)) { if (NILP (force)) error ("Attempt to delete the sole visible or iconified frame"); @@ -2275,7 +2273,7 @@ of them (the selected terminal frame) is actually displayed. { struct frame *f = decode_live_frame (frame); - if (NILP (force) && !other_frames (f, true)) + if (NILP (force) && !other_frames (f, true, false)) error ("Attempt to make invisible the sole visible or iconified frame"); /* Don't allow minibuf_window to remain on an invisible frame. */ @@ -2878,6 +2876,9 @@ Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol. struct frame *f = decode_live_frame (frame); Lisp_Object prop, val; + if (EQ (alist, Qt)) + return Qnil; + /* I think this should be done with a hook. */ #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f))