From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks Date: Tue, 21 May 2019 20:52:34 -0400 Message-ID: <87ftp79up9.fsf@gmail.com> References: <87muug4z52.fsf@gmail.com> <87y3dy3i05.fsf@gmail.com> <83muudrqol.fsf@gnu.org> <83effosvx2.fsf@gnu.org> <87r2jo3l0w.fsf@gmail.com> <837elgss8l.fsf@gnu.org> <87sh40189j.fsf@gmail.com> <83zhy7o0i0.fsf@gnu.org> <83h8keodsi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="186569"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: 32257@debbugs.gnu.org To: Andy Moreton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 22 02:53:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTFVJ-000mQz-PK for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 May 2019 02:53:14 +0200 Original-Received: from localhost ([127.0.0.1]:33478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTFVI-0005s7-Rt for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 May 2019 20:53:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTFV9-0005qA-8i for bug-gnu-emacs@gnu.org; Tue, 21 May 2019 20:53:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTFV8-0007ex-7E for bug-gnu-emacs@gnu.org; Tue, 21 May 2019 20:53:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55957) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTFV8-0007eg-20 for bug-gnu-emacs@gnu.org; Tue, 21 May 2019 20:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hTFV7-00022f-Qi for bug-gnu-emacs@gnu.org; Tue, 21 May 2019 20:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 May 2019 00:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32257 X-GNU-PR-Package: emacs Original-Received: via spool by 32257-submit@debbugs.gnu.org id=B32257.15584863677827 (code B ref 32257); Wed, 22 May 2019 00:53:01 +0000 Original-Received: (at 32257) by debbugs.gnu.org; 22 May 2019 00:52:47 +0000 Original-Received: from localhost ([127.0.0.1]:41268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hTFUs-000228-PS for submit@debbugs.gnu.org; Tue, 21 May 2019 20:52:47 -0400 Original-Received: from mail-it1-f176.google.com ([209.85.166.176]:35832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hTFUq-00021m-Sl; Tue, 21 May 2019 20:52:45 -0400 Original-Received: by mail-it1-f176.google.com with SMTP id u186so450418ith.0; Tue, 21 May 2019 17:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=yOYB5ZLD9ozR/ZmJhRkaYDQwrb5C0MpXDq69kup1XM4=; b=aUm7tnNWTXBRj3HB85Ag9XcBJMRXrUW9cvkNYeVGyljuMj1OSe42Dlz+zCaZgJlEoO UmPEUVMmqMO5/A7MlcRY1ZzGW6Pzuu2PKVA0Vdo+uLagQHW7nGNyVf+EMVIK6WCy6BC7 pApnTXBaj8zexN3g0IzVZVrTt2lohG3EEbTh2qHs9Eh76RWHHC59RY23D3ZHxvhVFFoy HjAemV5gK38Hd2JnQ4ECH6sO7e7WCJ43YkkKjvUAUeNYgwe91X17Xqgsgpcf5fdc0WXD zqrE0Fz1jgrItmGqZwnCE6RytOpWbhe7gpBQZ76LzhKGT5YSbA8czx4DqpFWCPooYtc6 ODWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=yOYB5ZLD9ozR/ZmJhRkaYDQwrb5C0MpXDq69kup1XM4=; b=isYUdyulGckC6/ZlEHLvTVaPFwDT1k44UbE07Pz5l+GytvZwZJifV35/Ed6GrhcEXA 6wZBzow0bnJ3RGk2NW/dt10rZY4F7nf175tXmWqaMCSLWixEiAjKP3jJRvD3yYsb7zTu MJWNeY/pQKAvHQoiY93jas3Pt2l2Rmkq1D76AslusBcMdCstncyQWM53nUuZw1XkWNBz EHNpOIphNaHgPShzVbD31sNdHEt+Iv8lw60yDQ3qVLAHVO+8gG/7FpTwdkNG6hycnnm9 YElNm5uoLk+hJ3waqeCzjzxOAcQ2iKFhKNcQsZvXUtbKsArXgVk3k255MB4PnuILLrpP TQCA== X-Gm-Message-State: APjAAAW/H6iktY+yErBbFMxBJ00rgCkbtk0xg2VqCkiYOzCQP20AkwK1 lwuXRNAuLoZD/4mCXD2k+LcQ+psU X-Google-Smtp-Source: APXvYqzV1z4wIEs9K4tZXFKek5NmjKVaoqkZB2/EO68NNXCUpK1BrNlv+vmyAf3WZbAkyJdNfnwwrA== X-Received: by 2002:a24:910b:: with SMTP id i11mr6552335ite.110.1558486358869; Tue, 21 May 2019 17:52:38 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id 74sm2478457itk.3.2019.05.21.17.52.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 17:52:37 -0700 (PDT) In-Reply-To: (Andy Moreton's message of "Wed, 01 Aug 2018 13:05:12 +0100") 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: 209.51.188.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:159626 Archived-At: --=-=-= Content-Type: text/plain tags 32257 + patch quit Andy Moreton writes: > On Wed 01 Aug 2018, Eli Zaretskii wrote: >>> >>> Noam's original patch may bring some possibility of new problems, >>> but it does at least fix the original problem (on emacs-26 and >>> master). >> >> Fixing a problem and introducing another doesn't sound wise to me. >> We've been there several times during the last years, and I don't want >> to make the same mistake again. Sorry. > > Perhaps reverting the patches that introduced read-multiple-choice > is the right answer then. How about for emacs-26, we call read-event only after receiving the problematic error. This works around the problem, and should be safe enough, since it only triggers when we would otherwise be ending up in an infloop anyway. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-infloop-in-read-multiple-choice-Bug-32257.patch Content-Description: patch >From 8545e36df343cc169d7ae1ab3a43c9805cd51015 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 21 May 2019 20:33:09 -0400 Subject: [PATCH] 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 6d1adae974..5411f2ba77 100644 --- a/lisp/emacs-lisp/rmc.el +++ b/lisp/emacs-lisp/rmc.el @@ -116,10 +116,15 @@ read-multiple-choice (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 -- 2.11.0 --=-=-= Content-Type: text/plain And master can just use read-event. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-infloop-in-read-multiple-choice-Bug-32257.patch Content-Description: patch >From f1f32043f65dc19b6d63cf1ce52ef19b46c14e22 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 21 May 2019 20:38:00 -0400 Subject: [PATCH] Avoid infloop in read-multiple-choice (Bug#32257) * lisp/emacs-lisp/rmc.el (read-multiple-choice): Use `read-event' which won't get stuck (return the same event over and over again) for non-character events, unlike `read-char'. --- lisp/emacs-lisp/rmc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el index 6d1adae974..47f3b8dc9c 100644 --- a/lisp/emacs-lisp/rmc.el +++ b/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-event)) (error nil)))) (setq answer (lookup-key query-replace-map (vector tchar) t)) (setq tchar -- 2.11.0 --=-=-=--