* 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.
This commit is contained in:
Tim Ruffing 2023-12-27 14:29:34 +01:00 committed by Stefan Monnier
parent 385a02cffd
commit d6f326452e
2 changed files with 14 additions and 3 deletions

View file

@ -11573,6 +11573,18 @@ 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 other levels of the input processing
stages). */
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 +11593,7 @@ if there is a doubt, the value is t.
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). */

View file

@ -484,6 +484,7 @@ extern int gobble_input (void);
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);