]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid infloop in read-multiple-choice (Bug#32257)
authorNoam Postavsky <npostavs@gmail.com>
Wed, 22 May 2019 00:33:09 +0000 (20:33 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 26 May 2019 12:46:30 +0000 (08:46 -0400)
* 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

index 6d1adae9749097668e7ab5235f6a4a4b4e712198..5411f2ba77b231a733aa0f30ddb53e6f125aa3f2 100644 (file)
@@ -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