]> git.eshelyaron.com Git - emacs.git/commitdiff
rmc.el: Use read-key instead of read-event like they do upstream
authorEshel Yaron <me@eshelyaron.com>
Sun, 9 Feb 2025 08:34:14 +0000 (09:34 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Feb 2025 08:34:14 +0000 (09:34 +0100)
lisp/emacs-lisp/rmc.el
test/lisp/emacs-lisp/rmc-tests.el

index 94ed4aac60f953e92a96748f5116359f5f0ee9f2..9bef7fe780fe3282bfb1677290322d88c5d51b86 100644 (file)
@@ -299,7 +299,9 @@ Usage example:
             (message (concat invalid-choice full-prompt))
             (setq tchar
                   (condition-case nil
-                      (let ((cursor-in-echo-area t)) (read-event))
+                      (let ((cursor-in-echo-area t) (key (read-key)))
+                        (when (eq key ?\C-g) (signal 'quit nil))
+                        key)
                     (error nil)))
             (setq result (assq tchar choices)))
           result)
index b4e7992fab8191e254a45e94f3de32b778672c33..d91704423c896441ffea8224e8567f58d3fe5bfe 100644 (file)
@@ -51,7 +51,7 @@
 
 (ert-deftest test-read-multiple-choice ()
   (dolist (char '(?y ?n))
-    (cl-letf* (((symbol-function #'read-event) (lambda () char))
+    (cl-letf* (((symbol-function #'read-key) (lambda () char))
                (str (if (eq char ?y) "yes" "no")))
       (should (equal (list char str)
                      (read-multiple-choice "Do it? " '((?y "yes") (?n "no"))))))))
@@ -59,7 +59,7 @@
 (ert-deftest test-read-multiple-choice-help ()
   (let ((chars '(?? ?a))
         help)
-    (cl-letf* (((symbol-function #'read-event)
+    (cl-letf* (((symbol-function #'read-key)
                 (lambda ()
                   (message "chars %S" chars)
                   (when (= 1 (length chars))