emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/bind-map df2f5081e1 27/97: Use custom kbd command


From: ELPA Syncer
Subject: [nongnu] elpa/bind-map df2f5081e1 27/97: Use custom kbd command
Date: Thu, 20 Jan 2022 07:59:11 -0500 (EST)

branch: elpa/bind-map
commit df2f5081e18e98b6300d99a6f540872ee8420813
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>

    Use custom kbd command
---
 bind-map.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/bind-map.el b/bind-map.el
index 9be3ed5ff6..c53d4bb8cf 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -137,8 +137,8 @@ Declare a prefix command for MAP named COMMAND-NAME."
          (activate (intern (format "%s-activate" map)))
          (activate-func (intern (format "%s-activate-function" map)))
          (prefix-cmd (plist-get args :prefix-cmd))
-         (keys (mapcar 'kbd (plist-get args :keys)))
-         (evil-keys (mapcar 'kbd (plist-get args :evil-keys)))
+         (keys (mapcar 'bind-map-kbd (plist-get args :keys)))
+         (evil-keys (mapcar 'bind-map-kbd (plist-get args :evil-keys)))
          (evil-states (or (plist-get args :evil-states)
                           bind-map-default-evil-states))
          (minor-modes (plist-get args :minor-modes))
@@ -235,6 +235,9 @@ MAPS, and KEYS."
                (dolist (map (list ,@maps))
                  (evil-define-key state map key ,def))
              (evil-global-set-key state key ,def)))))))
+(defun bind-map-kbd (key)
+  (if (stringp key) (kbd key) (kbd (eval key))))
+
 
 ;;;###autoload
 (defun bind-map-set-keys (map key def &rest bindings)
@@ -243,7 +246,7 @@ Default bindings never override existing ones. BINDINGS is a
 series of KEY DEF pairs. Each KEY should be a string suitable for
 `kbd'."
   (while key
-    (define-key map (kbd key) def)
+    (define-key map (bind-map-kbd key) def)
     (setq key (pop bindings) def (pop bindings))))
 (put 'bind-map-set-keys 'lisp-indent-function 'defun)
 
@@ -254,8 +257,8 @@ Default bindings never override existing ones. BINDINGS is a
 series of KEY DEF pairs. Each KEY should be a string suitable for
 `kbd'."
   (while key
-    (unless (lookup-key map (kbd key))
-      (define-key map (kbd key) def))
+    (unless (lookup-key map (bind-map-kbd key))
+      (define-key map (bind-map-kbd key) def))
     (setq key (pop bindings) def (pop bindings))))
 (put 'bind-map-set-key-defaults 'lisp-indent-function 'defun)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]