diff options
| author | Richard M. Stallman | 1993-07-22 09:01:22 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-07-22 09:01:22 +0000 |
| commit | c08c95c7afc653758f005970bb8eb4add7454885 (patch) | |
| tree | ee6ddbe601eae7bf7349a3be03a7c60fec809034 /src | |
| parent | 54939090dc87d4ed11c68855a07769e3141d3fc9 (diff) | |
| download | emacs-c08c95c7afc653758f005970bb8eb4add7454885.tar.gz emacs-c08c95c7afc653758f005970bb8eb4add7454885.zip | |
(Fdelete_frame): Allow deletion if there is some other
visible (perhaps iconified) frame. Also allow deleting terminal frame
if there are X frames.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/frame.c b/src/frame.c index e706283a0b2..4bfa9640bde 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -574,7 +574,7 @@ DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, | |||
| 574 | "Return the next frame in the frame list after FRAME.\n\ | 574 | "Return the next frame in the frame list after FRAME.\n\ |
| 575 | By default, skip minibuffer-only frames.\n\ | 575 | By default, skip minibuffer-only frames.\n\ |
| 576 | If omitted, FRAME defaults to the selected frame.\n\ | 576 | If omitted, FRAME defaults to the selected frame.\n\ |
| 577 | If optional argument MINIFRAME is non-nil, include minibuffer-only frames.\n\ | 577 | If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\ |
| 578 | If MINIFRAME is a window, include only frames using that window for their\n\ | 578 | If MINIFRAME is a window, include only frames using that window for their\n\ |
| 579 | minibuffer.\n\ | 579 | minibuffer.\n\ |
| 580 | If MINIFRAME is non-nil and not a window, include all frames.") | 580 | If MINIFRAME is non-nil and not a window, include all frames.") |
| @@ -615,9 +615,29 @@ A frame may not be deleted if its minibuffer is used by other frames.") | |||
| 615 | if (! FRAME_LIVE_P (f)) | 615 | if (! FRAME_LIVE_P (f)) |
| 616 | return Qnil; | 616 | return Qnil; |
| 617 | 617 | ||
| 618 | /* Are there any other frames besides this one? */ | 618 | /* If all other frames are invisible, refuse to delete. |
| 619 | if (f == selected_frame && EQ (next_frame (frame, Qt), frame)) | 619 | (Exception: allow deleting the terminal frame when using X.) */ |
| 620 | error ("Attempt to delete the only frame"); | 620 | if (f == selected_frame) |
| 621 | { | ||
| 622 | Lisp_Object frames; | ||
| 623 | int count = 0; | ||
| 624 | |||
| 625 | for (frames = Vframe_list; | ||
| 626 | CONSP (frames); | ||
| 627 | frames = XCONS (frames)->cdr) | ||
| 628 | { | ||
| 629 | Lisp_Object this = XCONS (frames)->car; | ||
| 630 | |||
| 631 | if (FRAME_VISIBLE_P (XFRAME (this)) | ||
| 632 | || FRAME_ICONIFIED_P (XFRAME (this)) | ||
| 633 | /* Allow deleting the terminal frame when at least | ||
| 634 | one X frame exists! */ | ||
| 635 | || FRAME_X_P (XFRAME (this)) && !FRAME_X_P (f)) | ||
| 636 | count++; | ||
| 637 | } | ||
| 638 | if (count == 1) | ||
| 639 | error ("Attempt to delete the only frame"); | ||
| 640 | } | ||
| 621 | 641 | ||
| 622 | /* Does this frame have a minibuffer, and is it the surrogate | 642 | /* Does this frame have a minibuffer, and is it the surrogate |
| 623 | minibuffer for any other frame? */ | 643 | minibuffer for any other frame? */ |