changeset 91641:d17766001931

(Fdelete_frame): If FORCE, don't call hooks. If FORCE, and frame has a surrogate minibuffer for another frame, delete the other frame first.
author Richard M. Stallman <rms@gnu.org>
date Fri, 08 Feb 2008 02:38:08 +0000
parents 5c66006150b2
children a25d41a606b7
files src/frame.c
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/frame.c	Fri Feb 08 00:02:57 2008 +0000
+++ b/src/frame.c	Fri Feb 08 02:38:08 2008 +0000
@@ -1342,7 +1342,9 @@
 
 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 @@
 	      && 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 @@
   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.  */