Emacs Keys: Keybinding Functions (emacs 29 and emacs 28)
Emacs 29 keybinding function change
Emacs 29 (date 2023) added many new function for keybinding.
The old functions are still supported.
Their syntax is pretty much the same.
emacs 29 | emacs 28 |
---|---|
keymap-set | define-key |
keymap-global-set | global-set-key |
keymap-local-set | local-set-key |
keymap-global-unset | global-unset-key |
keymap-local-unset | local-unset-key |
keymap-substitute | substitute-key-definition |
keymap-set-after | define-key-after |
keymap-lookup | lookup-key and key-binding |
keymap-local-lookup | local-key-binding |
keymap-global-lookup | global-key-binding |
;; example ;; emacs 29 syntax (keymap-global-set "C-t" #'whitespace-mode) ;; emacs 28 or before (global-set-key (kbd "C-t") #'whitespace-mode)
Other Keybinding Functions Change
- ***
where-is-internal
can now filter events marked as non key events. If a command maps to a key binding like '[some-event]', andsome-event
has a symbol plist containing a non-nilnon-key-event
property, then that binding is ignored bywhere-is-internal
. - *** New functions for defining and manipulating keystrokes.
These all take the syntax defined by
key-valid-p
, which is basically the same syntax as the one accepted by the 'kbd' macro. None of the older functions have been deprecated or altered, but they are now de-emphasized in the documentation, and we encourage Lisp programs to switch to these new functions. - ***
define-key
now takes an optional REMOVE argument. If non-nil, remove the definition from the keymap. This is subtly different from setting a definition to nil: when the keymap has a parent such a definition will shadow the parent's definition.
Emacs, Change Keys
- Emacs Keys: Define Key
- Emacs Keys: Keybinding Functions (emacs 29 and emacs 28)
- Emacs Keys: Syntax
- Emacs Keys: Good and Bad Key Choices
- Emacs Keys: Swap CapsLock Control
- Emacs Keys: Meta Key
- Emacs Keys: Change Major Mode Keys
- Emacs Keys: Change Minor Mode Keys
- Emacs Keys: Minor Modes Key Priority
- Emacs Keys: Change Minibuffer Keys