This was never checked in, even though it is strictly an improvement to the current situation (see my original email for why I believe this is an improvement to emacs users as a whole). Are you still working on refining it or would you mind checking it in as it is? -a On Mon, Aug 11, 2008 at 10:40 AM, Chong Yidong wrote: > "Ami Fischman" writes: > > > Emacs has code to deal with C-g being entered while a quit is already > > in progress, meant to suspend emacs and drop the user to the superior > > shell or debugger (see section 59.7 Emergency Escape of the emacs > > info). This is done if emacs believes it's a good idea, which > > criteria includes "running in tty mode". Unfortunately this was never > > updated to work correctly with the multi-tty patch. > > Thanks for pointing this out. > > IIUC, the "emergency C-g" behavior is geared towards the traditional > setup where there's only one text-only terminal available. There, the > emergency C-g is the only way to drop back to the shell if Emacs gets > stuck. > > It's disabled for graphical terminals because there, you can open up a > separate terminal to kill/suspend the Emacs process. > > This implies that we should disable the emergency C-g if Emacs is > running on more than one terminal, as in the following patch. > > *** trunk/src/keyboard.c.~1.969.~ 2008-08-05 17:08:23.000000000 -0400 > --- trunk/src/keyboard.c 2008-08-11 13:35:43.000000000 -0400 > *************** > *** 10953,10958 **** > --- 10953,10976 ---- > errno = old_errno; > } > > + /* If there is exactly one terminal active, return it. Otherwise, > + return NULL. */ > + > + static struct terminal * > + just_one_tty_p () > + { > + struct terminal *t, *found = NULL; > + for (t = terminal_list; t; t = t->next_terminal) > + if (TERMINAL_ACTIVE_P (t)) > + { > + if (found) > + return NULL; > + else > + found = t; > + } > + return found; > + } > + > /* This routine is called at interrupt level in response to C-g. > > It is called from the SIGINT handler or kbd_buffer_store_event. > *************** > *** 10968,10980 **** > handle_interrupt () > { > char c; > > cancel_echoing (); > > - /* XXX This code needs to be revised for multi-tty support. */ > if (!NILP (Vquit_flag) > #ifndef MSDOS > ! && get_named_tty ("/dev/tty") > #endif > ) > { > --- 10986,10999 ---- > handle_interrupt () > { > char c; > + struct terminal *t; > > cancel_echoing (); > > if (!NILP (Vquit_flag) > #ifndef MSDOS > ! && (t = just_one_tty_p (), t) > ! && t->type == output_termcap > #endif > ) > { >