branch: externals/compat commit 5988ede6867fc9e85bf9b0064b709676e68b0e2b Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Apply keymap.el fixes from emacs-29 branch --- compat-29.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/compat-29.el b/compat-29.el index 99fd3d5712..6d6adfe7f6 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.