GNU bug report logs - #32257
26.1; read-multiple-choice inf loops on mouse clicks

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> gmail.com>

Date: Tue, 24 Jul 2018 12:07:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 26.1

Fixed in version 26.3

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: andrewjmoreton <at> gmail.com, 32257 <at> debbugs.gnu.org
Subject: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
Date: Mon, 30 Jul 2018 21:52:40 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> >> > If we want this change on emacs-26, we should carefully audit all the
>> >> > other users of rmc.el
>> 
>> What should we check for though?
>
> Anything that read-event handles differently from read-char.  Maybe a
> good starting point is to compile a list of the differences in
> behavior between the two.

Looking at the implementation, they both delegate to
read_filtered_event, but read-char passes 1 for the first three args,
where read-event passes 0.

   If NO_SWITCH_FRAME, switch-frame events are stashed
   until we get a character we like, and then stuffed into
   unread_switch_frame.

   If ASCII_REQUIRED, check function key events to see
   if the unmodified version of the symbol has a Qascii_character
   property, and use that character, if present.

   If ERROR_NONASCII, signal an error if the input we
   get isn't an ASCII character with modifiers.  If it's false but
   ASCII_REQUIRED is true, just re-read until we get an ASCII
   character.

Another possibility is to use read-char-exclusive which only changes
ERROR_NON_ASCII to 0.  The downside is that when there are mouse clicks
it prints the events into the minibuffer, covering the prompt (but
typing "?"  still works to restore the prompt).

--- i/lisp/emacs-lisp/rmc.el
+++ w/lisp/emacs-lisp/rmc.el
@@ -118,7 +118,7 @@ read-multiple-choice
                             choices)))
                   (condition-case nil
                       (let ((cursor-in-echo-area t))
-                        (read-char))
+                        (read-char-exclusive))
                     (error nil))))
           (setq answer (lookup-key query-replace-map (vector tchar) t))
           (setq tchar




This bug report was last modified 5 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.