changeset 58965:47204c294c8d

(Vthrow_on_input): New variable. (syms_of_keyboard): Defvar and initialize it. (kbd_buffer_store_event_hold): Handle Vthrow_on_input.
author Kim F. Storm <storm@cua.dk>
date Wed, 15 Dec 2004 00:04:39 +0000
parents 57cb3872bd94
children 3e2d3004c744
files src/keyboard.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Tue Dec 14 14:20:44 2004 +0000
+++ b/src/keyboard.c	Wed Dec 15 00:04:39 2004 +0000
@@ -3580,6 +3580,9 @@
 }
 #endif
 
+
+Lisp_Object Vthrow_on_input;
+
 /* Store an event obtained at interrupt level into kbd_buffer, fifo */
 
 void
@@ -3705,6 +3708,14 @@
       *kbd_store_ptr = *event;
       ++kbd_store_ptr;
     }
+
+  /* If we're in a section that requested to be interrupted as soon
+     as input comes, then set quit-flag to cause an interrupt.  */
+  if (!NILP (Vthrow_on_input)
+      && event->kind != FOCUS_IN_EVENT
+      && event->kind != HELP_EVENT
+      && event->kind != DEICONIFY_EVENT)
+    Vquit_flag = Vthrow_on_input;
 }
 
 
@@ -11377,6 +11388,12 @@
 	       doc: /* *How long to display an echo-area message when the minibuffer is active.
 If the value is not a number, such messages don't time out.  */);
   Vminibuffer_message_timeout = make_number (2);
+
+  DEFVAR_LISP ("throw-on-input", &Vthrow_on_input,
+	       doc: /* If non-nil, any keyboard input throws to this symbol.
+The value of that variable is passed to `quit-flag' and later causes a
+peculiar kind of quitting.  */);
+  Vthrow_on_input = Qnil;
 }
 
 void