Mercurial > emacs
comparison src/frame.c @ 4227:b283670201b4
(Fdelete_frame): Allow deletion if there is some other
visible (perhaps iconified) frame. Also allow deleting terminal frame
if there are X frames.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 22 Jul 1993 09:01:22 +0000 |
parents | 020fe391d5c1 |
children | d07ef5ea3b58 |
comparison
equal
deleted
inserted
replaced
4226:7c7e33d6386d | 4227:b283670201b4 |
---|---|
572 | 572 |
573 DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, | 573 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.") |
581 (frame, miniframe) | 581 (frame, miniframe) |
582 Lisp_Object frame, miniframe; | 582 Lisp_Object frame, miniframe; |
613 } | 613 } |
614 | 614 |
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? */ |
624 if (FRAME_HAS_MINIBUF_P (XFRAME (frame))) | 644 if (FRAME_HAS_MINIBUF_P (XFRAME (frame))) |
625 { | 645 { |