summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2019-05-21 20:33:09 -0400
committerNoam Postavsky <npostavs@gmail.com>2019-05-26 08:46:30 -0400
commitc4d4dcf17e407a3c68e150f22b9756ef6c943070 (patch)
tree783560c9e3462a4cb3b7259cc31a21729d9a408a
parent2168165ec05aa663d41998adb518e778899a8edd (diff)
downloademacs-c4d4dcf17e407a3c68e150f22b9756ef6c943070.tar.gz
Avoid infloop in read-multiple-choice (Bug#32257)
* lisp/emacs-lisp/rmc.el (read-multiple-choice): When `read-char' signals an error "Non-character input-event", call `read-event' to take the non-character event out of the queue. Don't merge to master, we just use `read-event' directly there, rather than this solution which relies a particular error message.
-rw-r--r--lisp/emacs-lisp/rmc.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 6d1adae9749..5411f2ba77b 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -116,10 +116,15 @@ Usage example:
(cons (capitalize (cadr elem))
(car elem)))
choices)))
- (condition-case nil
+ (condition-case err
(let ((cursor-in-echo-area t))
(read-char))
- (error nil))))
+ (error (when (equal (cadr err) "Non-character input-event")
+ ;; Use up the non-character input-event.
+ ;; Otherwise we'll just keep reading it
+ ;; again and again (Bug#32257).
+ (read-event))
+ nil))))
(setq answer (lookup-key query-replace-map (vector tchar) t))
(setq tchar
(cond