*** frame.h.~1.145.~ 2008-11-14 07:21:31.062500000 +0100 --- frame.h 2008-11-29 12:27:15.156250000 +0100 *************** *** 1115,1120 **** --- 1115,1121 ---- Lisp_Object component, Lisp_Object subclass); + extern Lisp_Object delete_frame P_ ((Lisp_Object, Lisp_Object)); #endif /* HAVE_WINDOW_SYSTEM */ *** frame.c.~1.399.~ 2008-11-29 12:04:07.515625000 +0100 --- frame.c 2008-11-29 12:26:53.468750000 +0100 *************** *** 1322,1341 **** extern Lisp_Object Qrun_hook_with_args; ! DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", ! doc: /* Delete FRAME, permanently eliminating it from use. ! If omitted, FRAME defaults to the selected frame. ! A frame may not be deleted if its minibuffer is used by other frames. ! Normally, you may not delete a frame if all other frames are invisible, ! 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. ! But FORCE inhibits this too. */) ! /* FORCE is non-nil when handling a disconnected terminal. */ ! (frame, force) ! Lisp_Object frame, force; { struct frame *f; struct frame *sf = SELECTED_FRAME (); --- 1322,1330 ---- extern Lisp_Object Qrun_hook_with_args; ! Lisp_Object ! delete_frame (frame, force) ! register Lisp_Object frame, force; { struct frame *f; struct frame *sf = SELECTED_FRAME (); *************** *** 1360,1371 **** if (NILP (force) && !other_visible_frames (f)) error ("Attempt to delete the sole visible or iconified frame"); - #if 0 /* This is a nice idea, but x_connection_closed needs to be able to delete the last frame, if it is gone. */ ! if (NILP (XCDR (Vframe_list))) error ("Attempt to delete the only frame"); - #endif /* Does this frame have a minibuffer, and is it the surrogate minibuffer for any other frame? */ --- 1349,1358 ---- if (NILP (force) && !other_visible_frames (f)) error ("Attempt to delete the sole visible or iconified frame"); /* This is a nice idea, but x_connection_closed needs to be able to delete the last frame, if it is gone. */ ! if (NILP (XCDR (Vframe_list)) && !EQ (force, Qnoelisp)) error ("Attempt to delete the only frame"); /* Does this frame have a minibuffer, and is it the surrogate minibuffer for any other frame? */ *************** *** 1386,1392 **** (FRAME_MINIBUF_WINDOW (XFRAME (this)))))) { /* 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"); --- 1373,1379 ---- (FRAME_MINIBUF_WINDOW (XFRAME (this)))))) { /* If we MUST delete this frame, delete the other first. */ ! if (EQ (force, Qnoelisp)) Fdelete_frame (this, force); else error ("Attempt to delete a surrogate minibuffer frame"); *************** *** 1634,1639 **** --- 1621,1645 ---- return Qnil; } + + DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", + doc: /* Delete FRAME, permanently eliminating it from use. + If omitted, FRAME defaults to the selected frame. + A frame may not be deleted if its minibuffer is used by other frames. + Normally, you may not delete a frame if all other frames are invisible, + 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. + But FORCE inhibits this too. */) + /* FORCE is non-nil when handling a disconnected terminal. */ + (frame, force) + Lisp_Object frame, force; + { + return delete_frame (frame, !NILP (force) ? Qt : Qnil); + } + /* Return mouse position in character cell units. */ *** terminal.c.~1.13.~ 2008-11-29 12:04:07.843750000 +0100 --- terminal.c 2008-11-29 12:23:14.406250000 +0100 *************** *** 256,262 **** struct terminal **tp; Lisp_Object tail, frame; ! /* Protect against recursive calls. Fdelete_frame calls the delete_terminal_hook when we delete our last frame. */ if (!terminal->name) return; --- 256,262 ---- struct terminal **tp; Lisp_Object tail, frame; ! /* Protect against recursive calls. delete_frame calls the delete_terminal_hook when we delete our last frame. */ if (!terminal->name) return; *************** *** 270,276 **** if (FRAME_LIVE_P (f) && f->terminal == terminal) { /* Maybe this should pass Qnoelisp rather than Qt? */ ! Fdelete_frame (frame, Qt); } } --- 270,276 ---- if (FRAME_LIVE_P (f) && f->terminal == terminal) { /* Maybe this should pass Qnoelisp rather than Qt? */ ! delete_frame (frame, Qnoelisp); } }