I want to make a prefix key. So which command is better for making a prefix key?
REF:
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI want to make a prefix key. So which command is better for making a prefix key?
REF:
The short answer:
If you wish the prefix to be present in all buffers and all modes, use global-set-key
. If you wish it to be present only in one mode, use local-set-key
.
The difference between the two is what keymap they put the binding into: The global one, or the local one. When you type a key sequence, the local map is searched first, then the global one. So a binding in the local map could shadow the global binding. Each major mode typically defines its own local map, which is shared among all buffers using that mode.
There is much more to say about keymaps and keymap searching, but this should be a good start.