bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks


From: Eli Zaretskii
Subject: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
Date: Fri, 27 Jul 2018 12:08:58 +0300

> From: Noam Postavsky <address@hidden>
> Date: Wed, 25 Jul 2018 21:25:46 -0400
> Cc: lars ingebrigtsen <address@hidden>, andy moreton <address@hidden>
> > Starting from emacs -Q, evaluate:
> >
> >     (require 'rmc)
> >     (read-multiple-choice "choice? " '((?a "ay") (?b "bee") (?c "see")))
> >
> > then click the mouse somewhere instead of answering the prompt, notice
> > Emacs maxing out CPU, hit C-g.  *Messages* will have a log of the prompt
> > being repeated many times:
> >
> >     choice?  (ay, bee, [c] see, ?):  [4435 times]
> 
> The problem seems to be that read-char doesn't "use up" non-character
> events, e.g., with the following:
> 
> (defun read-char-or-err ()
>   (condition-case err
>       (read-char)
>     (error err)))
> 
> (list (read-char-or-err)
>       (read-char-or-err)
>       (read-char-or-err)
>       (read-char-or-err)
>       (read-char-or-err))
> 
> this returns ((error "Non-character input-event") (error "Non-character
> input-event") ...) regardless of how many calls to read-char-or-err
> there are.
> 
> The patch below fixes the inf looping, although it still doesn't allow
> any other user interaction (unlike read-from-minibuffer).

If we want this change on emacs-26, we should carefully audit all the
other users of rmc.el (and in generally, I'd prefer some more local
change in nsm.el on the release branch).  We've had our share of
subtle bugs introduced by switching to an "almost-compatible" method
of reading input.

Thanks.





reply via email to

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