]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fdelete_frame): If FORCE, don't call hooks.
authorRichard M. Stallman <rms@gnu.org>
Fri, 8 Feb 2008 02:38:15 +0000 (02:38 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 8 Feb 2008 02:38:15 +0000 (02:38 +0000)
If FORCE, and frame has a surrogate minibuffer for another frame,
delete the other frame first.

src/ChangeLog
src/frame.c

index 7cd786a22ff4fdd7703166c6b60d9298950cc4aa..350e5573d171f9dd41ec9d59741154489fc77be2 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-08  Richard Stallman  <rms@gnu.org>
+
+       * frame.c (Fdelete_frame): If FORCE, don't call hooks.
+       If FORCE, and frame has a surrogate minibuffer for another frame,
+       delete the other frame first.
+
 2008-02-07  Timo Savola  <timo.savola@iki.fi>
 
        * xterm.c (x_detect_focus_change): Handle embed client message.
index 30c5e5e9d36e8fa229c8b4e928a5fedd9ce1fba4..fec911f4b0c5c64a6b839c0f27892d25cdbe82f4 100644 (file)
@@ -1342,7 +1342,9 @@ but if the second optional argument FORCE is non-nil, you may do so.
 
 This function runs `delete-frame-functions' before actually deleting the
 frame, unless the frame is a tooltip.
-The functions are run with one arg, the frame to be deleted.  */)
+The functions are run with one arg, the frame to be deleted.
+But FORCE inhibits this too.  */)
+/* FORCE is non-nil when handling a disconnected terminal.  */
      (frame, force)
      Lisp_Object frame, force;
 {
@@ -1393,12 +1395,21 @@ The functions are run with one arg, the frame to be deleted.  */)
              && EQ (frame,
                     WINDOW_FRAME (XWINDOW
                                   (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
-           error ("Attempt to delete a surrogate minibuffer frame");
+           {
+             /* If we MUST delete this frame, delete the other first.  */
+             if (!NILP (force))
+               Fdelete_frame (this, force);
+             else
+               error ("Attempt to delete a surrogate minibuffer frame");
+           }
        }
     }
 
-  /* Run `delete-frame-functions' unless frame is a tooltip.  */
-  if (!NILP (Vrun_hooks)
+  /* Run `delete-frame-functions'
+     unless FORCE is true or frame is a tooltip.
+     FORCE is set when handling a disconnect from the terminal,
+     so we don't dare call Lisp code.  */
+  if (!NILP (Vrun_hooks) && NILP (force)
       && NILP (Fframe_parameter (frame, intern ("tooltip"))))
     {
       Lisp_Object args[2];
@@ -1418,6 +1429,9 @@ The functions are run with one arg, the frame to be deleted.  */)
   if (! FRAME_LIVE_P (f))
     return Qnil;
 
+  /* At this point, we are committed to deleting the frame.
+     There is no more chance for errors to prevent it.  */
+
   minibuffer_selected = EQ (minibuf_window, selected_window);
 
   /* Don't let the frame remain selected.  */