From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#31692: Emacs sometimes drops key events Date: Sat, 09 Jun 2018 00:17:47 +0200 Message-ID: <87zi042a9g.fsf@web.de> References: <83wovgd2aj.fsf@gnu.org> <87po163v65.fsf@web.de> <83in6yarhe.fsf@gnu.org> <877encq5co.fsf@web.de> <8336y0x9c3.fsf@gnu.org> <87zi078r8n.fsf@web.de> <83efhiwrmj.fsf@gnu.org> <83602uwq3y.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528496232 1281 195.159.176.226 (8 Jun 2018 22:17:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2018 22:17:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: radon.neon@gmail.com, 31692@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 09 00:17: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 1fRPgr-0008UP-LK for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jun 2018 00:17:01 +0200 Original-Received: from localhost ([::1]:38338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRPiy-0000nv-Cf for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Jun 2018 18:19:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRPir-0000nf-Vb for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 18:19:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRPio-0004Lo-O0 for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 18:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60459) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRPio-0004Lb-Jo for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 18:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fRPio-0004Tu-5n for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 18:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Jun 2018 22:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31692 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31692-submit@debbugs.gnu.org id=B31692.152849630117176 (code B ref 31692); Fri, 08 Jun 2018 22:19:02 +0000 Original-Received: (at 31692) by debbugs.gnu.org; 8 Jun 2018 22:18:21 +0000 Original-Received: from localhost ([127.0.0.1]:40123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRPi9-0004Sy-5j for submit@debbugs.gnu.org; Fri, 08 Jun 2018 18:18:21 -0400 Original-Received: from mout.web.de ([212.227.15.3]:45855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRPi6-0004Sj-Fw for 31692@debbugs.gnu.org; Fri, 08 Jun 2018 18:18:19 -0400 Original-Received: from drachen.dragon ([188.110.196.170]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MHJEh-1fV2kQ2WeJ-00E7yp; Sat, 09 Jun 2018 00:17:49 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 07 Jun 2018 14:44:36 -0400") X-Provags-ID: V03:K1:wzmVTToro+QeZ1HMtLSLtlld4pukSPQN90+bq+ownohkGpsYoN2 NqM6KK04GmCk0/zPVIJwjp9/vX4UNRgfrhW1hDnxB/fOF7jMebksaVD+tDRL9PyKyf13ReS NMXJBXB0pp/gstjptVsEQyELyFMF5Ryic++6Zx01TO1PHRVBW1Pt4gGgBx/fu+3DSe9rePZ qMKt4R0+tArPbPo0r7CJg== X-UI-Out-Filterresults: notjunk:1;V01:K0:Vd0AQPEIBHo=:Z+EEE6Yj+Y3TVLbwc4Peah 5xh+2ZhllDZfavPAcI263rGJoJIuYFZcdtvGmE3dSE+ciwV7d98bLWIqNTqGx0IdgAMMV42J6 Cct8pUm6Dm40CvVcN3pizW1hAdOKf69Xya76Tetdg9DDsts2vj0f3BGFA7uWm0s9BCvLWAzlz +TS7LMCN2k9z4XPO1QuAO7lIos81KClULUdYqvt0mVu1kPw2wSV4+S0uI6WnCKYVe5rUkumKe WHFygX/HkfCqQ61W0yi+m0Dregcdk/mZQrZ+igfDuOf+et3d41RNMWNzZeVvnIu2e1aZvgo// FcpEBZTiEX9WGBi3h/VBcxIeN7zbiIrRTcbSPcxiw//aTgamTNyEnBaSneVxy79srKDIT8wxo F0ErD1doiTp2tjXF88frnnI7O2SOD3NW2tU0N8Lx4lEOSQWZlHRkrxu4NHZ7CGfFhYCZ3rdOU dTZMEJr7rxw3XgTowoB4HF8d/ujgTSxvS4extlTz45syGkPL+1n31In3Emd2A+ZwHF5ftMSUT TBbLknny0wGxLHP0d1w8f+LFgwOQ2uKdBo4oG/KLD8i7fjc39mq/ROpXM2TuhHWGWZHmX2RA1 jwOVRENJFYi/lW08UwnfnzZ6VZ1M4f1V4Llc2FpCEZcrcm+nFjSZILUBR5qcyei/TnT+dSy3z /oLRb8jt3U1h53tJ8i6nm5M8VQu0pLPfCuknxpMS1r8byvKSeSSFIH5e7OPNAarE0/XLtdNGn 1Feqef+DMxuJKItKo9c1N8gcjlgziv9PYalNCFVRuB+ojUOSRznDeQWirpeNnjffLHbAIYxe 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:147213 Archived-At: Stefan Monnier writes: > As a consequence, instead of > > (throw 'throw-on-input t) > > we need to throw like > > (throw throw-on-input t) > > and we additionally need to (setq quit-flag nil) before that. I tried to adapt Eli's patch accordingly. To avoid confusion, I simply use the concrete value - the CATCH-SYM - and just return t instead of throwing: diff --git a/lisp/subr.el b/lisp/subr.el index 914112ccef..7734006d87 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3520,9 +3520,25 @@ while-no-input (let ((catch-sym (make-symbol "input"))) `(with-local-quit (catch ',catch-sym - (let ((throw-on-input ',catch-sym)) - (or (input-pending-p) - (progn ,@body))))))) + (let ((throw-on-input ',catch-sym) + val) + (setq val + (or (input-pending-p) + (progn ,@body))) + (cond + ;; If quit-flag is bound to the CATCH-SYM, it means BODY + ;; didn't test quit-flag, and therefore ran to completion + ;; even though input arrived before it finished. In that + ;; case, we must reset quit-flag (and return t), because + ;; otherwise quit-flag will remain set, and we get Quit to + ;; top-level, which has undesirable consequences, such as + ;; discarding input etc. + ((eq quit-flag ',catch-sym) + (setq quit-flag nil) + t) + ;; This is in case the user actually quits while BODY runs. + (quit-flag nil) + (t val))))))) (defmacro condition-case-unless-debug (var bodyform &rest handlers) "Like `condition-case' except that it does not prevent debugging. Michael.