From 17593b2c1e7313b156ecc7077aaa019290b8a096 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Wed, 27 Dec 2023 14:29:34 +0100 Subject: [PATCH 3/5] * src/keyboard.c (requeued_events_pending_p): New function * src/keyboard.c, src/keyboard.h (requeued_events_pending_p): Add function 'requeued_events_pending_p' (whose name was made available in the previous commit). As opposed to the previous function with the same name, the new function covers both command and other events. * src/keyboard.c (Finput_pending_p): Use the new function. --- src/keyboard.c | 15 ++++++++++++--- src/keyboard.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index e5efde4ef53..c898988dc5f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11573,6 +11573,17 @@ requeued_command_events_pending_p (void) return (CONSP (Vunread_command_events)); } +/* Return true if there are any pending requeued events (command events + or events to be processed by input methods). */ + +bool +requeued_events_pending_p (void) +{ + return (requeued_command_events_pending_p () + || !NILP (Vunread_post_input_method_events) + || !NILP (Vunread_input_method_events)); +} + DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0, doc: /* Return t if command input is currently available with no wait. Actually, the value is nil only if we can be sure that no input is available; @@ -11581,9 +11592,7 @@ DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0, If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */) (Lisp_Object check_timers) { - if (CONSP (Vunread_command_events) - || !NILP (Vunread_post_input_method_events) - || !NILP (Vunread_input_method_events)) + if (requeued_events_pending_p ()) return (Qt); /* Process non-user-visible events (Bug#10195). */ diff --git a/src/keyboard.h b/src/keyboard.h index 600aaf11517..2ce003fd444 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -484,6 +484,7 @@ #define EVENT_HEAD_KIND(event_head) \ extern bool input_polling_used (void); extern void clear_input_pending (void); extern bool requeued_command_events_pending_p (void); +extern bool requeued_events_pending_p (void); extern void bind_polling_period (int); extern int make_ctrl_char (int) ATTRIBUTE_CONST; extern void stuff_buffered_input (Lisp_Object); -- 2.44.0