Sometimes, when I type quickly I do something that change the keyboard layout: the key that would produce < now produces |. Problem is that I don't know how I cause that and how to undo that! If I close and open again Emacs everything is fine, but I would like to avoid it. Any clue?

  • 1
    M-x command-history to check what you might have activated by mistake Commented Jun 5, 2018 at 13:53
  • By default you can toggle an input method by typing C-\​ That's probably what you've typed by accident. You should be able to see that command in lossage F1 l.
    – user12563
    Commented Jun 5, 2018 at 14:29

1 Answer 1


You can use C-h l (command view-lossage) to see the last few key sequences (including mouse actions) that you used, plus their associated commands.

C-h k C-h l tells you:

view-lossage is an interactive compiled Lisp function in help.el.

It is bound to C-h l, f1 l, help l, menu-bar help-menu whereami view-lossage.


Display last few input keystrokes and the commands run.

For convenience this uses the same format as edit-last-kbd-macro.

To record all your input, use open-dribble-file.

That last statement tells you how to record more than just the last few keystrokes. C-h f open-dribble-file (or clicking the linked name in the previous help display) tells you:

open-dribble-file is an interactive built-in function in C source code.

(open-dribble-file FILE)

Start writing all keyboard characters to a dribble file called FILE.

If FILE is nil, close any open dribble file. The file will be closed when Emacs exits.

Be aware that this records ALL characters you type! This may include sensitive information such as passwords.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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