From: Jason S. Cornez Date: Tue, 10 Apr 2012 19:36:17 +0000 (-0400) Subject: * src/keyboard.c: Override inhibit-quit after the third C-g. X-Git-Tag: emacs-24.2.90~471^2~365^2~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6bbef4e552d1c3cbb08fc8b5224ebcaa663ff95a;p=emacs.git * src/keyboard.c: Override inhibit-quit after the third C-g. (force_quit_count): New var. (handle_interrupt): Use it. Fixes: debbugs:6585 --- diff --git a/src/ChangeLog b/src/ChangeLog index 76a8353b853..994b8d034ff 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-04-10 "Jason S. Cornez" (tiny change) + + * keyboard.c: Override inhibit-quit after the third C-g (bug#6585). + (force_quit_count): New var. + (handle_interrupt): Use it. + 2012-04-10 Juanma Barranquero * w32.c (w32_delayed_load): Record the full path of the library @@ -17,8 +23,8 @@ * process.h: Add integer `gnutls_handshakes_tried' member to process struct. - * gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit. Add - convenience `GNUTLS_LOG2i' macro. + * gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit. + Add convenience `GNUTLS_LOG2i' macro. * gnutls.c (gnutls_log_function2i): Convenience log function. (emacs_gnutls_read): Use new log functions, @@ -104,8 +110,8 @@ (xml_cleanup_parser): New function, export for fn_xmlCleanupParser. Calls xmlCleanupParser only if libxml2 was loaded (or statically linked in). - (Flibxml_parse_html_region, Flibxml_parse_xml_region): Call - init_libxml2_functions before calling libxml2 functions. + (Flibxml_parse_html_region, Flibxml_parse_xml_region): + Call init_libxml2_functions before calling libxml2 functions. (syms_of_xml) : DEFSYM it. * emacs.c: Don't include libxml/parser.h. diff --git a/src/keyboard.c b/src/keyboard.c index 50b2ade8ee4..9ff19d61d41 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10213,7 +10213,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); - gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); + gcpro1.nvars = (sizeof keybuf / sizeof (keybuf[0])); if (NILP (continue_echo)) { @@ -10227,7 +10227,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, cancel_hourglass (); #endif - i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), + i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), prompt, ! NILP (dont_downcase_last), ! NILP (can_return_switch_frame), 0); @@ -10918,6 +10918,11 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */ errno = old_errno; } +/* If Emacs is stuck because `inhibit-quit' is true, then keep track + of the number of times C-g has been requested. If C-g is pressed + enough times, then quit anyway. See bug#6585. */ +static int force_quit_count; + /* This routine is called at interrupt level in response to C-g. It is called from the SIGINT handler or kbd_buffer_store_event. @@ -11036,8 +11041,16 @@ handle_interrupt (void) UNGCPRO; } else - /* Else request quit when it's safe */ - Vquit_flag = Qt; + { /* Else request quit when it's safe. */ + if (NILP (Vquit_flag)) + force_quit_count = 0; + if (++force_quit_count == 3) + { + immediate_quit = 1; + Vinhibit_quit = Qnil; + } + Vquit_flag = Qt; + } } /* TODO: The longjmp in this call throws the NS event loop integration off,