Looking at how people program their keyboard shortcuts in Emacs, I have noticed two different patterns:
One uses:
(global-set-key (kbd "M-N) 'select-next-window)
The other one:
(define-key global-map (kbd "M-N") 'select-next-window)
What's the difference between them? Don't they both define "global" keyboard shortcuts in Emacs?
global-map
might be bound to a file or buffer local value, or it could even be bound in alet
statement. – Trey Jackson Dec 15 '11 at 23:09use-global-map
. There aren't many packages that do this: mostly a few emulation modes such as Viper, and some functions such asread-char
that override the global map temporarily. – Gilles 'SO- stop being evil' Dec 16 '11 at 08:11