9

How do I get keystrokes displayed in the echo area immediately?

For example: when I enter the key sequence C-u j, it will not display in the echo area immediately, but then I press key k, and I discover that I was making a typo beforehand. So, I think it will helpful for a newbie like me when I hit some keys to call a command for the echo area to show them immediately.

13

You are looking to adjust the value of the variable echo-keystrokes.

You can read its docstring by entering C-h v echo-keystrokes (or M-x describe-variable echo-keystrokes):

Documentation:

Nonzero means echo unfinished commands after this many seconds of pause. The value may be integer or floating point. If the value is zero, don't echo at all.

Note that you cannot set the value to 0 and have it echo instantaneously, but you can set it to an arbitrarily small number, which will feel instantaneous. You can therefore put something like the following in your init file:

(setq echo-keystrokes .1)
  • 6
    It turns out you can also set it to a negative value for immediate display (setq echo-keystrokes -1). – JeanPierre Dec 10 '16 at 14:24
  • 1
    @JeanPierre : Neat! I didn't realize that! Seems like it should be in the documentation. – Dan Dec 10 '16 at 14:33
  • 2
    @JeanPierre -- (setq echo-keystrokes -1) does not have the effect that you described in Emacs 25 built --with-ns. Instead, it has the same effect as a value of 0 -- i.e., don't echo at all. [This is GNU Emacs 25.1.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549)) of 2016-09-17.] I also tested a build of the master-branch from earlier this year and had the same results. echo_keystrokes_p (void) {return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0 : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0 : false);} – lawlist Dec 10 '16 at 18:08
  • @lawlist Oh, you're right I've been sloppy, it does not work for me on GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1) of 2016-10-24, modified by Debian but does with GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-08 on binet, modified by Debian. – JeanPierre Dec 10 '16 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.