10

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.

Drew
  • 75,699
  • 9
  • 109
  • 225
jimmy
  • 103
  • 5

1 Answers1

15

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)
Dan
  • 32,584
  • 6
  • 98
  • 168
  • 7
    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
  • 3
    @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
  • On 28.2 (setq echo-keystrokes 0.01) works for me (-1 didn't) – Ev Dolzhenko Apr 12 '23 at 06:42