Loading Ecaml breaks the echoing of unfinished keystrokes
By default, Emacs displays unfinished keystrokes in the echo area if the user types slow enough. This behavior is broken when loading Ecaml. The problem seems to come from the initialization code of Ecaml, more precisely the start of the Async scheduler:
https://github.com/janestreet/ecaml/blob/68fa60749bcf25ea2c1378a8fe2da0eb4f53bf45/src/async_ecaml.ml#L692
Moreover, shutting down the scheduler via M-x ecaml-async-shutdown restores the echoing of unfinished keystrokes.
The problem was observed using the latest version of both Ecaml (v0.15.0) and Emacs (28.2).
Thanks for reporting this. Unfortunately, I don't know if there's a good way to fix this in Ecaml.
The Async scheduler, by necessity, regularly sends input events to Emacs (as local network data). Otherwise, there would be no way for Async to wake up Emacs and ask it to run code in response to, say, file I/O being complete.
However, because these input events interrupt sit-for, they also prevent the echo-keystrokes setting from working as intended. You can get the same bad behavior without Ecaml by doing the following:
emacs -QM-x shell- Run
yes, which constantly produces some output that Emacs has to process in its event loop. - Now, press
C-xand observe that the keystroke is never displayed.
You could work around this issue somewhat by setting echo-keystrokes to a low value, such as 0.01, so that keystrokes are echoed immediately and almost always before some other input event arrives.
OK, I see. Thanks for the detailed explanation!