Subject: bug#78737: sit-for behavior changes when byte-compiled

From: Daniel Colascione <[email-masked]>
Date: Mon, 09 Jun 2025 13:48:59 -0700

Consider (while-no-input (sit-for 100)).

Run it and press any key, say, f to terminate the wait. You'll see "f"
inserted wherever point was.

Now eval-defun on sit-for from subr.el and try (while-no-input (sit-for
100)) again. The "f" disappears.

Why? Because Fread_event returns with Vquit_flag set; the byte-compiled
sit-for is able to push the event onto Vunread_command_events before
Lisp does something quit-able, but the interpreted sit-for doesn't get
so far and loses Fread_event's return value.

Fread_event should probably look for Vquit_flag and !Vinhibit_quit and
in this case stick the event on Vunread_command_events itself and
return nil.

WDYT?