From 236dfb0c8d971dd663fd2a8fef1c57e0bc6fe6af Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 26 Sep 2021 10:28:00 +0200 Subject: emacs/bqn-symbols.el: fix mapping for space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “key” needs to be the plain ASCII space instead of "SPC". With this change, space works properly for both the BQN-Z input mode and the modifier-based mode-map. Thanks to Leah Neukirchen for pointing this out. --- editors/emacs/bqn-symbols.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/emacs/bqn-symbols.el b/editors/emacs/bqn-symbols.el index aede9dc8..a016a0a3 100644 --- a/editors/emacs/bqn-symbols.el +++ b/editors/emacs/bqn-symbols.el @@ -139,7 +139,7 @@ ("left-double-arrow" "⇐" "?") ;; Space bar - ("ligature" "‿" "SPC") + ("ligature" "‿" " ") )) (provide 'bqn-symbols) -- cgit v1.2.3 From 46e810ac94dbdccecd1f03e0ce073e2268453c61 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 26 Sep 2021 14:38:52 +0200 Subject: emacs/bqn-input.el: key-sequence is never a list This is a small refactor removing sort-of-dead code. This of course removes the possibility to define multiple keys for a certain BQN character, but I'm not sure this is an actual use case we need to preserve. --- editors/emacs/bqn-input.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/editors/emacs/bqn-input.el b/editors/emacs/bqn-input.el index 82c0184b..db462c97 100644 --- a/editors/emacs/bqn-input.el +++ b/editors/emacs/bqn-input.el @@ -24,9 +24,8 @@ (defun bqn--make-base-mode-map (prefix) (let ((map (make-sparse-keymap))) (dolist (command bqn--symbols) - (let ((key-sequence (caddr command))) - (dolist (s (if (listp key-sequence) key-sequence (list key-sequence))) - (define-key map (bqn--kbd (concat prefix s)) (bqn--make-key-command-sym (car command)))))) + (let ((key (caddr command))) + (define-key map (bqn--kbd (concat prefix s)) (bqn--make-key-command-sym (car command))))) (define-key map [menu-bar bqn] (cons "BQN" (make-sparse-keymap "BQN"))) map)) -- cgit v1.2.3 From 23ad01959192779e17a313ac4537ae73bde2db00 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 26 Sep 2021 14:45:22 +0200 Subject: emacs/bqn-input.el: don't add broken bindings in the BQN mode map Using a plain space in emacs key binding syntax can be problematic (especially making users unable to type "s" if the mode map prefix is "s-"). Therefore we must make sure to convert the strings we have in bqn-symbols.el into proper emacs key syntax. Luckily we can use single-key-description to do exactly that. --- editors/emacs/bqn-input.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editors/emacs/bqn-input.el b/editors/emacs/bqn-input.el index db462c97..30af1ff3 100644 --- a/editors/emacs/bqn-input.el +++ b/editors/emacs/bqn-input.el @@ -24,8 +24,8 @@ (defun bqn--make-base-mode-map (prefix) (let ((map (make-sparse-keymap))) (dolist (command bqn--symbols) - (let ((key (caddr command))) - (define-key map (bqn--kbd (concat prefix s)) (bqn--make-key-command-sym (car command))))) + (let ((key (single-key-description (string-to-char (caddr command))))) + (define-key map (bqn--kbd (concat prefix key)) (bqn--make-key-command-sym (car command))))) (define-key map [menu-bar bqn] (cons "BQN" (make-sparse-keymap "BQN"))) map)) -- cgit v1.2.3