How to restored default keymap without restarting Emacs?

122 views Asked by At

I've somehow corrupted the key bindings in my current Emacs session.

Specifically, typing shift-M produces "m", rather than "M". This problem affects only the M key1.

My question is: how can I restore the default key bindings without restarting Emacs?


1I'm confident that the problem is a corrupted Emacs keymap. Typing the same shift-M key combination in other applications, or in other Emacs sessions (but, of course, still using the same keyboard, computer, etc.) produces the correct "M". Incidentally typing m (without shift-) in the Emacs session with the corrupted keymap works fine; it produces "m", as expected.

1

There are 1 answers

1
R. P. Dillon On BEST ANSWER

What does C-h k Shift-m say? If it got rebound, that call will tell you what it is bound to. It should be bound to self-insert-command.

Something like (global-set-key (kbd "M") 'self-insert-command) should do the trick to set it back. You can execute that using ielm or M-:. You might need to cut and paste the capital M from another app to type that, though.