diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-20 17:58:54 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-20 17:58:54 +0100 |
| commit | 5988ede6867fc9e85bf9b0064b709676e68b0e2b (patch) | |
| tree | 535d0b32198223383ad5bb798d9fba2e517d7c5b | |
| parent | 2aa415a6fa0ab87802e79b119f09746080425bc6 (diff) | |
Apply keymap.el fixes from emacs-29 branch
| -rw-r--r-- | compat-29.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/compat-29.el b/compat-29.el index 99fd3d5..6d6adfe 100644 --- a/compat-29.el +++ b/compat-29.el @@ -850,10 +850,17 @@ Bindings are always added before any inherited map. The order of bindings in a keymap matters only when it is used as a menu, so this function is not useful for non-menu keymaps." (keymap--check key) - (when after - (keymap--check after)) + (when (eq after t) (setq after nil)) ; nil and t are treated the same + (when (stringp after) + (keymap--check after) + (setq after (key-parse after))) + ;; If we're binding this key to another key, then parse that other + ;; key, too. + (when (stringp definition) + (keymap--check definition) + (setq definition (key-parse definition))) (define-key-after keymap (key-parse key) definition - (and after (key-parse after)))) + after)) (compat-defun keymap-lookup ;; <compat-tests:keymap-lookup> (keymap key &optional accept-default no-remap position) @@ -897,7 +904,7 @@ specified buffer position instead of point are used." (symbolp value)) (or (command-remapping value) value) value)) - (key-binding (kbd key) accept-default no-remap position))) + (key-binding (key-parse key) accept-default no-remap position))) (compat-defun keymap-local-lookup (keys &optional accept-default) ;; <compat-tests:keymap-local-lookup> "Return the binding for command KEYS in current local keymap only. |
