17

C-h l shows the lossage help buffer, which shows recent keystrokes. Pressing g appears to revert it, causing it to update. Unfortunately, enabling auto-revert-mode does not change it to update continuously.

It would be nice if I could open up another window or frame and just display lossage in real time to show viewers what I am typing. This could also be used for pairing in a tmux/tmate session. Some of the videos online have something like this, but they appear to be external applications and OS specific.

Is there a nice way to show keystrokes in real time as they occur from within Emacs?

20

Addressing the last question in your post: you can get an auto-updating log of commands & key strokes by using https://github.com/lewang/command-log-mode which is also available on MELPA - by default it only shows non-trivial commands (so no self-insert or cursor movement commands). It looks like this:

enter image description here

10

Yes. There's a package called mwe-log-commands, which is available in MELPA.

Just run M-x mwe:log-keyboard-commands to start recording, then M-x mwe:open-command-log-buffer will open a buffer which shows the typed commands in real time.

command-log-mode is a newer and more actively-maintained fork of mwe-log-commands, so it might be preferable these days.

7

You can use a post-command-hook to update the lossage buffer. The following snippet does that for you (on a buffer local basis), but it assumes you've renamed the lossage buffer to "Lossage" (so this way you can still open other help buffers).

(defun update-lossage-buffer ()
  "Update the \"Lossage\" buffer.
For this to work, visit the lossage buffer, and call
M-x rename-buffer Lossage RET"
  (save-excursion
    (let ((b (get-buffer "Lossage")))
      (when (buffer-live-p b)
        (with-current-buffer b
          (revert-buffer nil 'noconfirm))))))
(add-hook 'post-command-hook #'update-lossage-buffer nil 'local)
3

The lossage help buffer is not associated with a file on disk. Hence auto revert mode does not work. A pseudo realtime alternative can be using (open-dribble-file "FILE") which writes all keystrokes to FILE. Using auto-revert-tail-mode on FILE buffer can reflect the keystrokes.

Another way would be to advice self-insert-command(and some prefix keys) to echo to a buffer.

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.