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

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

[nongnu] elpa/free-keys edfd69dc36 17/19: [Fix #3] Add an option to spec


From: ELPA Syncer
Subject: [nongnu] elpa/free-keys edfd69dc36 17/19: [Fix #3] Add an option to specify multi-character keys
Date: Sat, 29 Jan 2022 08:02:54 -0500 (EST)

branch: elpa/free-keys
commit edfd69dc369b2647447b7c28c7c1163b1ddf45b4
Author: Matus Goljer <matus.goljer@gmail.com>
Commit: Matus Goljer <matus.goljer@gmail.com>

    [Fix #3] Add an option to specify multi-character keys
---
 free-keys.el | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/free-keys.el b/free-keys.el
index 3f28af63e9..b41f19e17d 100644
--- a/free-keys.el
+++ b/free-keys.el
@@ -46,8 +46,16 @@
   :group 'free-keys)
 
 (defcustom free-keys-keys 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=[]{};'\\:\"|,./<>?`~"
-  "String of keys that can be used as bindings."
-  :type 'string
+  "String or list of keys that can be used as bindings.
+
+In case of string, each letter is interpreted as a character to
+test.
+
+In case of list, each item is considered as key code.  This
+allows you to add keys such as TAB or RET."
+  :type '(choice
+          (string :tag "String of characters")
+          (repeat :tag "List of characters" string))
   :group 'free-keys)
 
 (defcustom free-keys-ignored-bindings nil
@@ -137,10 +145,14 @@ This simply calls `free-keys'."
   "Process free bindings for MODIFIER."
   (let (empty-keys)
     (mapc (lambda (key)
-            (let* ((key-name
+            (let* ((key-as-string (cond
+                                   ((characterp key) (char-to-string key))
+                                   ((stringp key) key)
+                                   (t (error "Key is not a character nor a 
string"))))
+                   (key-name
                     (if (not (equal modifier ""))
-                        (concat modifier "-" (char-to-string key))
-                      (char-to-string key)))
+                        (concat modifier "-" key-as-string)
+                      key-as-string))
                    (full-name
                     (if (and prefix (not (equal prefix ""))) (concat prefix " 
" key-name) key-name))
                    (binding



reply via email to

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