emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 c4d4dcf 2/2: Avoid infloop in read-multiple-choic


From: Noam Postavsky
Subject: [Emacs-diffs] emacs-26 c4d4dcf 2/2: Avoid infloop in read-multiple-choice (Bug#32257)
Date: Sun, 26 May 2019 08:47:03 -0400 (EDT)

branch: emacs-26
commit c4d4dcf17e407a3c68e150f22b9756ef6c943070
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.
---
 lisp/emacs-lisp/rmc.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 6d1adae..5411f2b 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



reply via email to

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