From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks Date: Fri, 27 Jul 2018 12:08:58 +0300 Message-ID: <83muudrqol.fsf@gnu.org> References: <87muug4z52.fsf@gmail.com> <87y3dy3i05.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1532682492 17642 195.159.176.226 (27 Jul 2018 09:08:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 27 Jul 2018 09:08:12 +0000 (UTC) Cc: 32257@debbugs.gnu.org, larsi@gnus.org, andrewjmoreton@gmail.com To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 27 11:08:07 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fiyjG-0004Ty-Ld for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Jul 2018 11:08:07 +0200 Original-Received: from localhost ([::1]:39844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiylN-0005XW-Hw for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Jul 2018 05:10:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiylD-0005XN-H6 for bug-gnu-emacs@gnu.org; Fri, 27 Jul 2018 05:10:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiyl8-00033H-VS for bug-gnu-emacs@gnu.org; Fri, 27 Jul 2018 05:10:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54527) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fiyl8-00033A-Pg for bug-gnu-emacs@gnu.org; Fri, 27 Jul 2018 05:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fiyl8-0003Wv-GG for bug-gnu-emacs@gnu.org; Fri, 27 Jul 2018 05:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Jul 2018 09:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32257 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32257-submit@debbugs.gnu.org id=B32257.153268257413531 (code B ref 32257); Fri, 27 Jul 2018 09:10:02 +0000 Original-Received: (at 32257) by debbugs.gnu.org; 27 Jul 2018 09:09:34 +0000 Original-Received: from localhost ([127.0.0.1]:59545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fiykc-0003W7-GJ for submit@debbugs.gnu.org; Fri, 27 Jul 2018 05:09:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57579) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fiykW-0003Vl-QK for 32257@debbugs.gnu.org; Fri, 27 Jul 2018 05:09:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiykN-0002dq-3b for 32257@debbugs.gnu.org; Fri, 27 Jul 2018 05:09:19 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiyk6-0002ZK-Eb; Fri, 27 Jul 2018 05:08:58 -0400 Original-Received: from [176.228.60.248] (port=2529 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fiyk5-0005YH-RV; Fri, 27 Jul 2018 05:08:58 -0400 In-reply-to: <87y3dy3i05.fsf@gmail.com> (message from Noam Postavsky on Wed, 25 Jul 2018 21:25:46 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149000 Archived-At: > From: Noam Postavsky > Date: Wed, 25 Jul 2018 21:25:46 -0400 > Cc: lars ingebrigtsen , andy moreton > > 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.