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

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

[elpa] externals/setup 5b178a4 06/17: Fix issue with :bind, :unbind and


From: Stefan Monnier
Subject: [elpa] externals/setup 5b178a4 06/17: Fix issue with :bind, :unbind and :rebind
Date: Sat, 13 Mar 2021 18:15:12 -0500 (EST)

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

    Fix issue with :bind, :unbind and :rebind
---
 setup.el | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/setup.el b/setup.el
index 5afdb72..1e884f9 100644
--- a/setup.el
+++ b/setup.el
@@ -228,9 +228,9 @@ A documentation string."
 (setup-define :bind
   (lambda (key fn)
     `(define-key (eval setup-map)
-       ,(cond ((stringp key) (kbd key))
-              ((symbolp key) `(kbd ,key))
-              (key))
+       ,(if (or (symbolp key) (stringp key))
+            `(kbd ,key)
+          ,key)
        #',fn))
   :signature '(KEY FUNCTION ...)
   :documentation "Bind KEY to FUNCTION in current map."
@@ -239,10 +239,10 @@ A documentation string."
 
 (setup-define :unbind
   (lambda (key)
-    `(define-key
-       ,(cond ((stringp key) (kbd key))
-              ((symbolp key) `(kbd ,key))
-              (key))
+    `(define-key (symbol-value setup-map)
+       ,(if (or (symbolp key) (stringp key))
+              `(kbd ,key)
+          ,key)
        nil))
   :signature '(KEY ...)
   :documentation "Unbind KEY in current map."
@@ -252,12 +252,12 @@ A documentation string."
 (setup-define :rebind
   (lambda (key fn)
     `(progn
-       (dolist (key (where-is-internal ',fn))
-         (define-key (eval setup-map) ,key nil))
-       (define-key
-         ,(cond ((stringp key) (kbd key))
-                ((symbolp key) `(kbd ,key))
-                (key))
+       (dolist (key (where-is-internal ',fn (eval setup-map)))
+         (define-key (eval setup-map) key nil))
+       (define-key (eval setup-map)
+         ,(if (or (symbolp key) (stringp key))
+              `(kbd ,key)
+            ,key)
          #',fn)))
   :signature '(KEY FUNCTION ...)
   :documentation "Unbind the current key for FUNCTION, and bind it to KEY."



reply via email to

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