bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#70139: [PATCH] Improve key-translate to support removing translation


From: Charalampos Mitrodimas
Subject: bug#70139: [PATCH] Improve key-translate to support removing translations
Date: Tue, 9 Apr 2024 11:14:34 +0000


On 4/7/24 17:45, Stefan Monnier wrote:
+            (lambda (form) (keymap--compile-check from (and to to)) form)))
                                                           ^^^^^^^^^^^
                                                           ??

    (keymap--check from)
-  (keymap--check to)
-  (or (char-table-p keyboard-translate-table)
-      (setq keyboard-translate-table
-            (make-char-table 'keyboard-translate-table nil)))
-  (aset keyboard-translate-table
-        (aref (key-parse from) 0)
-        (aref (key-parse to) 0)))
+  (when to
+    (keymap--check to))
+  (let ((from-key (key-parse from))
+        (to-key (and to (key-parse to))))
+    (when (> (length from-key) 1)
+      (error "FROM key %s is not a single key" from))
+    (when (and to (> (length to-key) 1))
+      (error "TO key %s is not a single key" to))
I'd check `=` while at it (if length is 0 the error is caught by
`aref`, but it's a less helpful error).


         Stefan

Updated & attached.

--
Charalampos

Attachment: 0001-Improve-key-translate-to-support-removing-translatio.patch
Description: Text Data


reply via email to

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