aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Möllmann2025-01-27 08:58:30 +0100
committerGerd Möllmann2025-02-04 15:38:02 +0100
commit1e01ae335dda0ebcbca71c50c066a3072dd9d022 (patch)
treed5ff11cd6493b33c9e1988229683fbea8c04ce48
parent4212b2630f7a9d754810c8c9641e766534b44098 (diff)
downloademacs-1e01ae335dda0ebcbca71c50c066a3072dd9d022.tar.gz
emacs-1e01ae335dda0ebcbca71c50c066a3072dd9d022.zip
Use read-key in read-multiple-choice (bug#75886)
* lisp/emacs-lisp/rmc.el (read-multiple-choice--short-answers): Use read-key instead of read-event because read-event doesn't use input-decode-map. * test/lisp/emacs-lisp/rmc-tests.el: Use read-key instead of read-event.
-rw-r--r--lisp/emacs-lisp/rmc.el10
-rw-r--r--test/lisp/emacs-lisp/rmc-tests.el4
2 files changed, 10 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 27e5d6c612b..c4df8cf2f98 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -216,8 +216,14 @@ Usage example:
216 (car elem))) 216 (car elem)))
217 prompt-choices))) 217 prompt-choices)))
218 (condition-case nil 218 (condition-case nil
219 (let ((cursor-in-echo-area t)) 219 (let ((cursor-in-echo-area t)
220 (read-event)) 220 ;; Do NOT use read-event here. That
221 ;; function does not consult
222 ;; input-decode-map (bug#75886).
223 (key (read-key)))
224 (when (eq key ?\C-g)
225 (signal 'quit nil))
226 key)
221 (error nil)))) 227 (error nil))))
222 (if (memq (car-safe tchar) '(touchscreen-begin 228 (if (memq (car-safe tchar) '(touchscreen-begin
223 touchscreen-end 229 touchscreen-end
diff --git a/test/lisp/emacs-lisp/rmc-tests.el b/test/lisp/emacs-lisp/rmc-tests.el
index 1bc8c90cad6..0237bc3f9e5 100644
--- a/test/lisp/emacs-lisp/rmc-tests.el
+++ b/test/lisp/emacs-lisp/rmc-tests.el
@@ -61,7 +61,7 @@
61 61
62(ert-deftest test-read-multiple-choice () 62(ert-deftest test-read-multiple-choice ()
63 (dolist (char '(?y ?n)) 63 (dolist (char '(?y ?n))
64 (cl-letf* (((symbol-function #'read-event) (lambda () char)) 64 (cl-letf* (((symbol-function #'read-key) (lambda () char))
65 (str (if (eq char ?y) "yes" "no"))) 65 (str (if (eq char ?y) "yes" "no")))
66 (should (equal (list char str) 66 (should (equal (list char str)
67 (read-multiple-choice "Do it? " '((?y "yes") (?n "no")))))))) 67 (read-multiple-choice "Do it? " '((?y "yes") (?n "no"))))))))
@@ -69,7 +69,7 @@
69(ert-deftest test-read-multiple-choice-help () 69(ert-deftest test-read-multiple-choice-help ()
70 (let ((chars '(?o ?a)) 70 (let ((chars '(?o ?a))
71 help) 71 help)
72 (cl-letf* (((symbol-function #'read-event) 72 (cl-letf* (((symbol-function #'read-key)
73 (lambda () 73 (lambda ()
74 (message "chars %S" chars) 74 (message "chars %S" chars)
75 (when (= 1 (length chars)) 75 (when (= 1 (length chars))