diff options
| author | Martin Rudalics | 2008-12-22 09:40:33 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2008-12-22 09:40:33 +0000 |
| commit | 56f2de103fd8ee430ae3d2f6a1b83d4aa2012f90 (patch) | |
| tree | 4dcbba9b999a65c7919278eb93fd5b821f9b5b2d /src/frame.c | |
| parent | caf857eb7c7815e1d11ed706fb4a789bc92c3924 (diff) | |
| download | emacs-56f2de103fd8ee430ae3d2f6a1b83d4aa2012f90.tar.gz emacs-56f2de103fd8ee430ae3d2f6a1b83d4aa2012f90.zip | |
* frame.c (delete_frame): New function derived from
Fdelete_frame to handle Qnoelisp value for FORCE argument.
Delete last frame iff FORCE equals Qnoelisp. (Bug#1450)
(Fdelete_frame): Call delete_frame. Remove line from doc-string
saying that FORCE non-nil doesn't run `delete-frame-functions'.
* frame.h: Extern delete_frame.
* window.c (window_loop):
* terminal.c (delete_terminal):
* xterm.c (x_connection_closed):
* xfns.c (Fx_hide_tip):
* w32fns.c (Fx_hide_tip): Call delete_frame instead of
Fdelete_frame.
Diffstat (limited to 'src/frame.c')
| -rw-r--r-- | src/frame.c | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/src/frame.c b/src/frame.c index a21bacc80da..307e68bdb01 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1322,20 +1322,13 @@ delete_frame_handler (Lisp_Object arg) | |||
| 1322 | 1322 | ||
| 1323 | extern Lisp_Object Qrun_hook_with_args; | 1323 | extern Lisp_Object Qrun_hook_with_args; |
| 1324 | 1324 | ||
| 1325 | DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", | 1325 | /* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME |
| 1326 | doc: /* Delete FRAME, permanently eliminating it from use. | 1326 | unconditionally. x_connection_closed and delete_terminal use |
| 1327 | If omitted, FRAME defaults to the selected frame. | 1327 | this. Any other value of FORCE implements the semantics |
| 1328 | A frame may not be deleted if its minibuffer is used by other frames. | 1328 | described for Fdelete_frame. */ |
| 1329 | Normally, you may not delete a frame if all other frames are invisible, | 1329 | Lisp_Object |
| 1330 | but if the second optional argument FORCE is non-nil, you may do so. | 1330 | delete_frame (frame, force) |
| 1331 | 1331 | register Lisp_Object frame, force; | |
| 1332 | This function runs `delete-frame-functions' before actually deleting the | ||
| 1333 | frame, unless the frame is a tooltip. | ||
| 1334 | The functions are run with one arg, the frame to be deleted. | ||
| 1335 | But FORCE inhibits this too. */) | ||
| 1336 | /* FORCE is non-nil when handling a disconnected terminal. */ | ||
| 1337 | (frame, force) | ||
| 1338 | Lisp_Object frame, force; | ||
| 1339 | { | 1332 | { |
| 1340 | struct frame *f; | 1333 | struct frame *f; |
| 1341 | struct frame *sf = SELECTED_FRAME (); | 1334 | struct frame *sf = SELECTED_FRAME (); |
| @@ -1360,12 +1353,10 @@ But FORCE inhibits this too. */) | |||
| 1360 | if (NILP (force) && !other_visible_frames (f)) | 1353 | if (NILP (force) && !other_visible_frames (f)) |
| 1361 | error ("Attempt to delete the sole visible or iconified frame"); | 1354 | error ("Attempt to delete the sole visible or iconified frame"); |
| 1362 | 1355 | ||
| 1363 | #if 0 | 1356 | /* x_connection_closed must have set FORCE to `noelisp' in order |
| 1364 | /* This is a nice idea, but x_connection_closed needs to be able | ||
| 1365 | to delete the last frame, if it is gone. */ | 1357 | to delete the last frame, if it is gone. */ |
| 1366 | if (NILP (XCDR (Vframe_list))) | 1358 | if (NILP (XCDR (Vframe_list)) && !EQ (force, Qnoelisp)) |
| 1367 | error ("Attempt to delete the only frame"); | 1359 | error ("Attempt to delete the only frame"); |
| 1368 | #endif | ||
| 1369 | 1360 | ||
| 1370 | /* Does this frame have a minibuffer, and is it the surrogate | 1361 | /* Does this frame have a minibuffer, and is it the surrogate |
| 1371 | minibuffer for any other frame? */ | 1362 | minibuffer for any other frame? */ |
| @@ -1385,19 +1376,20 @@ But FORCE inhibits this too. */) | |||
| 1385 | WINDOW_FRAME (XWINDOW | 1376 | WINDOW_FRAME (XWINDOW |
| 1386 | (FRAME_MINIBUF_WINDOW (XFRAME (this)))))) | 1377 | (FRAME_MINIBUF_WINDOW (XFRAME (this)))))) |
| 1387 | { | 1378 | { |
| 1388 | /* If we MUST delete this frame, delete the other first. */ | 1379 | /* If we MUST delete this frame, delete the other first. |
| 1389 | if (!NILP (force)) | 1380 | But do this only if FORCE equals `noelisp'. */ |
| 1390 | Fdelete_frame (this, force); | 1381 | if (EQ (force, Qnoelisp)) |
| 1382 | delete_frame (this, Qnoelisp); | ||
| 1391 | else | 1383 | else |
| 1392 | error ("Attempt to delete a surrogate minibuffer frame"); | 1384 | error ("Attempt to delete a surrogate minibuffer frame"); |
| 1393 | } | 1385 | } |
| 1394 | } | 1386 | } |
| 1395 | } | 1387 | } |
| 1396 | 1388 | ||
| 1397 | /* Run `delete-frame-functions' | 1389 | /* Run `delete-frame-functions' unless FORCE is `noelisp' or |
| 1398 | unless FORCE is `noelisp' or frame is a tooltip. | 1390 | frame is a tooltip. FORCE is set to `noelisp' when handling |
| 1399 | FORCE is set to `noelisp' when handling a disconnect from the terminal, | 1391 | a disconnect from the terminal, so we don't dare call Lisp |
| 1400 | so we don't dare call Lisp code. */ | 1392 | code. */ |
| 1401 | if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip")))) | 1393 | if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip")))) |
| 1402 | ; | 1394 | ; |
| 1403 | if (EQ (force, Qnoelisp)) | 1395 | if (EQ (force, Qnoelisp)) |
| @@ -1641,6 +1633,24 @@ But FORCE inhibits this too. */) | |||
| 1641 | 1633 | ||
| 1642 | return Qnil; | 1634 | return Qnil; |
| 1643 | } | 1635 | } |
| 1636 | |||
| 1637 | DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", | ||
| 1638 | doc: /* Delete FRAME, permanently eliminating it from use. | ||
| 1639 | FRAME defaults to the selected frame. | ||
| 1640 | |||
| 1641 | A frame may not be deleted if its minibuffer is used by other frames. | ||
| 1642 | Normally, you may not delete a frame if all other frames are invisible, | ||
| 1643 | but if the second optional argument FORCE is non-nil, you may do so. | ||
| 1644 | |||
| 1645 | This function runs `delete-frame-functions' before actually | ||
| 1646 | deleting the frame, unless the frame is a tooltip. | ||
| 1647 | The functions are run with one argument, the frame to be deleted. */) | ||
| 1648 | (frame, force) | ||
| 1649 | Lisp_Object frame, force; | ||
| 1650 | { | ||
| 1651 | return delete_frame (frame, !NILP (force) ? Qt : Qnil); | ||
| 1652 | } | ||
| 1653 | |||
| 1644 | 1654 | ||
| 1645 | /* Return mouse position in character cell units. */ | 1655 | /* Return mouse position in character cell units. */ |
| 1646 | 1656 | ||