From: Hamish.Macdonald@x400gate.bnr.ca (Hamish Macdonald)
Newsgroups: alt.lucid-emacs.bug
Subject: Re: Lucid Emacs inhibits deletion of the only *visible* screen
Date: 13 Nov 92 18:18:23 GMT
	<1992Nov11.011212.9659@bmerh85.bnr.ca>
Organization: Bell Northern Research

>>>>> On Wed, 11 Nov 92 01:12:12 GMT,
>>>>> In message <1992Nov11.011212.9659@bmerh85.bnr.ca>,
>>>>> I wrote:

Hamish> Yeah, I thought of all that, but can it at least be made an
Hamish> option?

Hamish> I'm going to change it in our copy in any case.

Here are patches for screen.c and window.c that make this an option.

If the variable "delete-last-visible-screen" is nil, then the existing
functionality (cannot delete last visible screen) is active.

If "delete-last-visible-screen" is non-nil, then the user can delete
the last visible screen.

Deleting the last window on a screen using delete-window obeys these
rules also.

*** screen.c.orig	Wed Nov 11 09:29:18 1992
--- screen.c	Fri Nov 13 11:03:45 1992
***************
*** 32,37 ****
--- 32,38 ----
  Lisp_Object Vscreen_list;
  Lisp_Object Vterminal_screen;
  Lisp_Object Vglobal_minibuffer_screen;
+ Lisp_Object Vdelete_last_visible_screen;
  
  extern Lisp_Object Vminibuffer_list;
  extern Lisp_Object get_minibuffer ();
***************
*** 487,494 ****
  	{
  	  if (EQ (screen, next_screen (screen, 0, 0)))
  	    error ("Attempt to delete the only screen");
! 	  else
! 	    error ("Attempt to delete the only visible screen");
  	}
        Fselect_screen (next);
      }
--- 488,497 ----
  	{
  	  if (EQ (screen, next_screen (screen, 0, 0)))
  	    error ("Attempt to delete the only screen");
! 	  else if (EQ (Vdelete_last_visible_screen, Qnil))
!           error ("Attempt to delete the only visible screen");
!         else
!           next = next_screen (screen, 0, 0);
  	}
        Fselect_screen (next);
      }
***************
*** 1176,1181 ****
--- 1179,1189 ----
  minibuffer of this screen.  It is up to you to create a suitable screen\n\
  and store it in this variable.");
    Vglobal_minibuffer_screen = Qnil;
+ 
+   DEFVAR_LISP ("delete-last-visible-screen", &Vdelete_last_visible_screen,
+  "If t, allows deletion of the last visible screen, if 1 or more invisible\n\
+ screens exist.  Defaults to nil.");
+   Vdelete_last_visible_screen = Qnil;
  
    /* This is set in init_window_once. */
    staticpro (&Vscreen_list);
*** window.c.orig	Fri Nov 13 11:29:28 1992
--- window.c	Fri Nov 13 11:29:59 1992
***************
*** 576,581 ****
--- 576,582 ----
    register Lisp_Object tem, parent, sib;
    register struct window *p;
    register struct window *par;
+   extern Lisp_Object Vdelete_last_visible_screen;
  
    if (NILP (window))
      window = selected_window;
***************
*** 592,600 ****
  	/* this screen isn't fully initialized yet; don't blow up. */
  	return Qnil;
        if (EQ (p->screen, next_screen (p->screen, 0, 1)))
! 	error ((EQ (p->screen, next_screen (p->screen, 0, 0))) ?
! 	       "Attempt to delete the only window on the only screen" :
! 	       "Attempt to delete the only window on the only visible screen");
        Fdelete_screen (p->screen);
        return Qnil;
      }
--- 593,602 ----
  	/* this screen isn't fully initialized yet; don't blow up. */
  	return Qnil;
        if (EQ (p->screen, next_screen (p->screen, 0, 1)))
!         if (EQ (p->screen, next_screen (p->screen, 0, 0)))
!           error ("Attempt to delete the only window on the only screen");
!         else if (EQ (Vdelete_last_visible_screen, Qnil))
! 	    error ("Attempt to delete the only window on the only visible screen");
        Fdelete_screen (p->screen);
        return Qnil;
      }
Newsgroups: alt.lucid-emacs.bug