diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2016-11-27 09:31:58 +0100 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2016-11-27 21:48:07 +0100 |
commit | d9dd884c7c1940cacfcc2d86d47220b40c520bb5 (patch) | |
tree | 6102f376c3567de21c173709185c90e6d41028af /src/keyboard.c | |
parent | 416adda38521c6246f77877c57843264fa4ae711 (diff) | |
download | emacs-d9dd884c7c1940cacfcc2d86d47220b40c520bb5.tar.gz emacs-d9dd884c7c1940cacfcc2d86d47220b40c520bb5.tar.bz2 emacs-d9dd884c7c1940cacfcc2d86d47220b40c520bb5.zip |
Allow configuring which event throw-on-input should ignore (bug#19547).
* src/keyboard.c (kbd_buffer_store_buffered_event):
Translate event to corresponding symbol from `while-no-input-ignore-events`
and check them with Fmemq.
(syms_of_keyboard): Declare new lisp variable `while-no-input-ignore-events`
and its symbols.
* lisp/subr.el (while-no-input-ignore-events): Add default values.
* doc/lispref/commands.texi (Event Input Misc):
Document while-no-input-ignore-events.
* etc/NEWS: Same.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r-- | src/keyboard.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 65938a5eb56..6d509dd42be 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3567,14 +3567,22 @@ kbd_buffer_store_buffered_event (union buffered_input_event *event, #endif /* subprocesses */ } + Lisp_Object ignore_event = Qnil; + + switch (event->kind) + { + case FOCUS_IN_EVENT: ignore_event = Qfocus_in; break; + case FOCUS_OUT_EVENT: ignore_event = Qfocus_out; break; + case HELP_EVENT: ignore_event = Qhelp; break; + case ICONIFY_EVENT: ignore_event = Qiconify; break; + case DEICONIFY_EVENT: ignore_event = Qdeiconify; break; + case SELECTION_REQUEST_EVENT: ignore_event = Qselection_request; break; + } + /* If we're inside while-no-input, and this event qualifies as input, set quit-flag to cause an interrupt. */ if (!NILP (Vthrow_on_input) - && event->kind != FOCUS_IN_EVENT - && event->kind != FOCUS_OUT_EVENT - && event->kind != HELP_EVENT - && event->kind != ICONIFY_EVENT - && event->kind != DEICONIFY_EVENT) + && !NILP (Fmemq (ignore_event, Vwhile_no_input_ignore_events))) { Vquit_flag = Vthrow_on_input; /* If we're inside a function that wants immediate quits, @@ -11164,6 +11172,10 @@ syms_of_keyboard (void) DEFSYM (Qiconify_frame, "iconify-frame"); DEFSYM (Qmake_frame_visible, "make-frame-visible"); DEFSYM (Qselect_window, "select-window"); + DEFSYM (Qhelp, "help"); + DEFSYM (Qiconify, "iconify"); + DEFSYM (Qdeiconify, "deiconify"); + DEFSYM (Qselection_request, "selection-request"); { int i; @@ -11822,6 +11834,11 @@ signals. */); /* Create the initial keyboard. Qt means 'unset'. */ initial_kboard = allocate_kboard (Qt); + + DEFVAR_LISP ("while-no-input-ignore-events", + Vwhile_no_input_ignore_events, + doc: /* Ignored events from while-no-input. */); + Vwhile_no_input_ignore_events = Qnil; } void |