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

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

[elpa] externals/embark 3f2a7c47e6: Switch to the new key convention


From: ELPA Syncer
Subject: [elpa] externals/embark 3f2a7c47e6: Switch to the new key convention
Date: Thu, 2 Feb 2023 12:57:34 -0500 (EST)

branch: externals/embark
commit 3f2a7c47e6095dc7ee0983e0e1993f8ddf28c313
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Omar AntolĂ­n <omar.antolin@gmail.com>

    Switch to the new key convention
    
    This change affects:
    
    - embark-help-key
    - embark-cycle-key
    - embark-keymap-prompter-key
---
 embark.el | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/embark.el b/embark.el
index d4a996bb95..28a5c2447a 100644
--- a/embark.el
+++ b/embark.el
@@ -231,27 +231,27 @@ prompts for an action with completion."
 (defcustom embark-keymap-prompter-key "@"
   "Key to switch to the keymap prompter from `embark-completing-read-prompter'.
 
-The key must be either a string or a vector.
-This is the key representation accepted by `define-key'."
-  :type '(choice key-sequence (const :tag "None" nil)))
+The key must be either nil or a string.  The
+string must be accepted by `key-valid-p'."
+  :type '(choice string (const :tag "None" nil)))
 
 (defcustom embark-cycle-key nil
   "Key used for `embark-cycle'.
 
 If the key is set to nil it defaults to the global binding of
-`embark-act'.  The key must be either a string or a vector.  This
-is the key representation accepted by `define-key'."
-  :type '(choice key-sequence (const :tag "Use embark-act key" nil)))
+`embark-act'.  The key must be a string which is accepted by
+`key-valid-p'."
+  :type '(choice string (const :tag "Use embark-act key" nil)))
 
-(defcustom embark-help-key "\C-h"
+(defcustom embark-help-key "C-h"
   "Key used for help.
 
-The key must be either nil, a string or a vector.  This
-is the key representation accepted by `define-key'."
-  :type '(choice (const :tag "Use 'C-h'" "\C-h")
-                 (const :tag "Use '?'" "?")
+The key must be either nil or a string.  The
+string must be accepted by `key-valid-p'."
+  :type '(choice (const "C-h")
+                 (const "?")
                  (const :tag "None" nil)
-                 key-sequence))
+                 string))
 
 (defcustom embark-keybinding-repeat
   (propertize "*" 'face 'embark-keybinding-repeat)
@@ -953,7 +953,11 @@ their own target finder.  See for example
 
 (defun embark--cycle-key ()
   "Return the key to use for `embark-cycle'."
-  (or embark-cycle-key (car (where-is-internal #'embark-act))))
+  (if embark-cycle-key
+      (if (key-valid-p embark-cycle-key)
+          (key-parse embark-cycle-key)
+        (error "`embark-cycle-key' is invalid"))
+    (car (where-is-internal #'embark-act))))
 
 (defun embark--raw-action-keymap (type)
   "Return raw action map for targets of given TYPE.
@@ -976,7 +980,7 @@ If CYCLE is non-nil bind `embark-cycle'."
      (when-let ((cycle-key (and cycle (embark--cycle-key))))
        (define-key map cycle-key #'embark-cycle))
      (when embark-help-key
-       (define-key map embark-help-key #'embark-keymap-help))
+       (keymap-set map embark-help-key #'embark-keymap-help))
      map)
    (embark--raw-action-keymap type)))
 
@@ -1303,7 +1307,7 @@ UPDATE function is passed to it."
                              (key-description cycle))
                             (define-key map cycle #'embark-act))))))
                     (when embark-keymap-prompter-key
-                      (define-key map embark-keymap-prompter-key
+                      (keymap-set map embark-keymap-prompter-key
                         (lambda ()
                           (interactive)
                           (message "Press key binding")
@@ -2369,7 +2373,7 @@ See `embark-act' for the meaning of the prefix ARG."
                        when (where-is-internal embark--command (list keymap))
                        collect keymap))))
     (when embark-help-key
-      (define-key map embark-help-key #'embark-keymap-help))
+      (keymap-set map embark-help-key #'embark-keymap-help))
     map))
 
 ;;;###autoload



reply via email to

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