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

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

[elpa] externals/setup c707965 10/25: Handle symbols in :global, :bind,


From: Stefan Monnier
Subject: [elpa] externals/setup c707965 10/25: Handle symbols in :global, :bind, :unbind and :rebind
Date: Wed, 14 Apr 2021 18:49:01 -0400 (EDT)

branch: externals/setup
commit c7079651d6bc17192238d451648543a5a91f53ab
Author: Philip K <philipk@posteo.net>
Commit: Philip K <philipk@posteo.net>

    Handle symbols in :global, :bind, :unbind and :rebind
---
 setup.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/setup.el b/setup.el
index 82463cb..b1a4724 100644
--- a/setup.el
+++ b/setup.el
@@ -266,7 +266,9 @@ the first FEATURE."
 (setup-define :global
   (lambda (key command)
     `(global-set-key
-      ,(if (stringp key) (kbd key) key)
+      ,(cond ((stringp key) (kbd key))
+             ((symbolp key) `(kbd ,key))
+             (t key))
       #',command))
   :documentation "Globally bind KEY to COMMAND."
   :debug '(form sexp)
@@ -275,7 +277,9 @@ the first FEATURE."
 (setup-define :bind
   (lambda (key command)
     `(define-key (symbol-value setup-map)
-       ,(if (stringp key) (kbd key) key)
+       ,(cond ((stringp key) (kbd key))
+              ((symbolp key) `(kbd ,key))
+              (t key))
        #',command))
   :documentation "Bind KEY to COMMAND in current map."
   :after-loaded t
@@ -285,7 +289,9 @@ the first FEATURE."
 (setup-define :unbind
   (lambda (key)
     `(define-key (symbol-value setup-map)
-       ,(if (stringp key) (kbd key) key)
+       ,(cond ((stringp key) (kbd key))
+              ((symbolp key) `(kbd ,key))
+              (t key))
        nil))
   :documentation "Unbind KEY in current map."
   :after-loaded t
@@ -298,7 +304,9 @@ the first FEATURE."
        (dolist (key (where-is-internal ',command (symbol-value setup-map)))
          (define-key (symbol-value setup-map) key nil))
        (define-key (symbol-value setup-map)
-         ,(if (stringp key) (kbd key) key)
+         ,(cond ((stringp key) (kbd key))
+                ((symbolp key) `(kbd ,key))
+                (t key))
          #',command)))
   :documentation "Unbind the current key for COMMAND, and bind it to KEY."
   :after-loaded t



reply via email to

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