1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

Avoid returning early in 'while-no-input' due to subprocesses

* src/keyboard.c (kbd_buffer_store_buffered_event): Support
also the internal buffer-switch events.
(syms_of_keyboard) <Qbuffer_switch>: New DEFSYM.

* lisp/subr.el (while-no-input-ignore-events): Ignore
'buffer-switch' events.  Reported by Michael Heerdegen
<michael_heerdegen@web.de>.

* etc/NEWS: Mention the change in behavior of 'while-no-input'
This commit is contained in:
Eli Zaretskii 2018-09-29 10:11:08 +03:00
parent e8a4d942dd
commit d416109f06
3 changed files with 14 additions and 1 deletions

View File

@ -123,6 +123,16 @@ be removed prior using the changed 'shadow-*' commands.
The old name is an alias of the new name. Future Emacs version will
obsolete it.
---
** 'while-no-input' does not return due to input from subprocesses.
Input that arrived from subprocesses while some code executed inside
the 'while-no-input' form injected an internal buffer-switch event
that counted as input and would cause 'while-no-input' to return,
perhaps prematurely. These buffer-switch events are now by default
ignored by 'while-no-input'; if you need to get the old behavior,
remove 'buffer-switch' from the list of events in
'while-no-input-ignore-events'.
* Lisp Changes in Emacs 26.2

View File

@ -3542,7 +3542,7 @@ is allowed once again. (Immediately, if `inhibit-quit' is nil.)"
;; Don't throw `throw-on-input' on those events by default.
(setq while-no-input-ignore-events
'(focus-in focus-out help-echo iconify-frame
make-frame-visible selection-request))
make-frame-visible selection-request buffer-switch))
(defmacro while-no-input (&rest body)
"Execute BODY only as long as there's no pending input.

View File

@ -3569,6 +3569,7 @@ kbd_buffer_store_buffered_event (union buffered_input_event *event,
case ICONIFY_EVENT: ignore_event = Qiconify_frame; break;
case DEICONIFY_EVENT: ignore_event = Qmake_frame_visible; break;
case SELECTION_REQUEST_EVENT: ignore_event = Qselection_request; break;
case BUFFER_SWITCH_EVENT: ignore_event = Qbuffer_switch; break;
default: ignore_event = Qnil; break;
}
@ -11104,6 +11105,8 @@ syms_of_keyboard (void)
/* Menu and tool bar item parts. */
DEFSYM (Qmenu_enable, "menu-enable");
DEFSYM (Qbuffer_switch, "buffer-switch");
#ifdef HAVE_NTGUI
DEFSYM (Qlanguage_change, "language-change");
DEFSYM (Qend_session, "end-session");