Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading Ecaml breaks the echoing of unfinished keystrokes #14

Open
ilankri opened this issue Mar 31, 2023 · 2 comments
Open

Loading Ecaml breaks the echoing of unfinished keystrokes #14

ilankri opened this issue Mar 31, 2023 · 2 comments
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.

Comments

@ilankri
Copy link
Contributor

ilankri commented Mar 31, 2023

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:

start_scheduler ();

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).

@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Apr 3, 2023
@bcc32
Copy link
Member

bcc32 commented Apr 3, 2023

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:

  1. emacs -Q
  2. M-x shell
  3. Run yes, which constantly produces some output that Emacs has to process in its event loop.
  4. Now, press C-x and 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.

@ilankri
Copy link
Contributor Author

ilankri commented Apr 4, 2023

OK, I see. Thanks for the detailed explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.
Projects
None yet
Development

No branches or pull requests

3 participants