Reputation: 14441
By mistake I have binded M-x ( used for doing all the operations ) to a newly defined function ? How do I unbind it ? Now Alt-x always executes my function :( I dont want to exit emacs and restart again, I have lot of buffers open, so is there a way out here ?
Upvotes: 2
Views: 348
Reputation: 20018
You could invoke M-:
(or Alt-Shift-;
) to run eval-expression
. Then use global-set-key
to reassign "M-x" to its default value (execute-extended-command
).
If you're worried about having a lot of buffers open and losing your workspace, you can always enable the desktop
extension, which will save and restore the state of your buffers and windows.
Upvotes: 4
Reputation: 15486
The command usually run is execute-extended-command
, just rebind it.
To rebind it, you have several options:
Just make what you did before, but just use instead your own function above mentioned execute-extended-command
. If you did it with M-x command, then you maybe dont know, but M-x is not only produced by Alt-x
, but as there are keyboard layouts that have no Alt (or Meta) key, you can use Esc x
instead.
Rebind it with elisp command. To do this, change to the *scratch*
buffer, enter
(global-set-key (kbd "M-x") 'execute-extended-command)
and execute it with C-j
.
Maybe by using the menue (I usually dont use it, so I am not sure on this point)
Upvotes: 6