[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 d416109: Avoid returning early in 'while-no-input
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-26 d416109: Avoid returning early in 'while-no-input' due to subprocesses |
Date: |
Sat, 29 Sep 2018 03:12:49 -0400 (EDT) |
branch: emacs-26
commit d416109f06ab3910e3f49176185154a5179b6354
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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
<address@hidden>.
* etc/NEWS: Mention the change in behavior of 'while-no-input'
---
etc/NEWS | 10 ++++++++++
lisp/subr.el | 2 +-
src/keyboard.c | 3 +++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index 578b9b8..bfd7db0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
diff --git a/lisp/subr.el b/lisp/subr.el
index 7582b6c..59f6949 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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.
diff --git a/src/keyboard.c b/src/keyboard.c
index 1da5ac0..0d56ea3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -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");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 d416109: Avoid returning early in 'while-no-input' due to subprocesses,
Eli Zaretskii <=