From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#34535: 27.0.50; emacs -nw: while-no-input + sit-for + => Quit Date: Sat, 23 Feb 2019 10:21:20 +0200 Message-ID: <834l8urk3j.fsf@gnu.org> References: <87r2c4ennz.fsf@web.de> <83k1hrrejp.fsf@gnu.org> <87pnrjqgcn.fsf@web.de> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="231417"; mail-complaints-to="usenet@blaine.gmane.org" Cc: monnier@iro.umontreal.ca, 34535@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 09:22:13 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 1gxSZY-000y61-Uk for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2019 09:22:13 +0100 Original-Received: from localhost ([127.0.0.1]:34597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxSZX-0002Fq-OC for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2019 03:22:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxSZP-0002FN-ND for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2019 03:22:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxSZP-0005W1-06 for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2019 03:22:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35263) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxSZO-0005Vl-Ms for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2019 03:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gxSZO-0003wr-Fy for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2019 03:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Feb 2019 08:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34535 X-GNU-PR-Package: emacs Original-Received: via spool by 34535-submit@debbugs.gnu.org id=B34535.155091008615116 (code B ref 34535); Sat, 23 Feb 2019 08:22:01 +0000 Original-Received: (at 34535) by debbugs.gnu.org; 23 Feb 2019 08:21:26 +0000 Original-Received: from localhost ([127.0.0.1]:48807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gxSYo-0003vj-GL for submit@debbugs.gnu.org; Sat, 23 Feb 2019 03:21:26 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gxSYm-0003vW-W5 for 34535@debbugs.gnu.org; Sat, 23 Feb 2019 03:21:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxSYg-0004sz-Ma; Sat, 23 Feb 2019 03:21:18 -0500 Original-Received: from [176.228.60.248] (port=1194 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gxSYf-0002Mk-CP; Sat, 23 Feb 2019 03:21:18 -0500 In-reply-to: <87pnrjqgcn.fsf@web.de> (message from Michael Heerdegen on Sat, 23 Feb 2019 05:27:36 +0100) 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: 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:155673 Archived-At: > From: Michael Heerdegen > Cc: Stefan Monnier , 34535@debbugs.gnu.org > Date: Sat, 23 Feb 2019 05:27:36 +0100 > > This seems fixed for me with your patch. Thanks for testing. I'll push the change in a few days, if nothing pops up to the contrary. > In real real life, I made it so that while-no-input only covers the > computation needed for the minibuffer hint (counting matches) which must > be interruptible, but not the sit-for used to delay the minibuffer hint > being removed. That sit-for was inside while-no-input originally was a > matter of laziness, I was able to rewrite it to circumvent the issue. Please note that using while-no-input with BODY that reads some input in a way causes indeterminate results, because whether the arriving input will be read and consumed by BODY and/or used to throw control flow out of BODY, depends on seemingly random factors, like whether Emacs checks quit-flag before or after BODY consumes the input and acts upon it. For example, in your test case: (while-no-input (sit-for 20)) there's a conceptual difficulty in deciding whether pressing a key during the 20-sec wait should return nil or t. On the one hand, arriving input should end BODY and return t, but OTOH that same input causes sit-for to stop waiting, so BODY finishes, and while-no-input should return what sit-for returned, i.e. nil. What actually happens depends on the underlying implementation, which is sometimes platform-dependent, and on what a more complex BODY does. IOW, I think while-no-input does not (and cannot) reliably produce deterministic output in the case where BODY itself reads input. We try to DTRT, but there can be no general guarantees in these cases.