From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: A whole lotta auto-saving going Date: Wed, 13 Jan 2021 17:25:39 -0500 Message-ID: References: <8735zdyly0.fsf@gnus.org> <87y2h1vyhq.fsf@gnus.org> <877dokq0fz.fsf@gnus.org> <83y2h0g0rk.fsf@gnu.org> <83k0sjfrad.fsf@gnu.org> <831rerfm7p.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3312"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: larsi@gnus.org, aaronjensen@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 13 23:26:32 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzob2-0000mH-3h for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Jan 2021 23:26:32 +0100 Original-Received: from localhost ([::1]:52206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzob1-0002bK-6O for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Jan 2021 17:26:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzoaO-00026B-14 for emacs-devel@gnu.org; Wed, 13 Jan 2021 17:25:52 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzoaG-00070m-Eu; Wed, 13 Jan 2021 17:25:48 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id ADB0D80880; Wed, 13 Jan 2021 17:25:42 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 09B95801F3; Wed, 13 Jan 2021 17:25:41 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1610576741; bh=WUg+SgjE1ce90SqLGrR6mnF5jFrS8NeM99fvwCgHaU4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=NKZKrHOL+Z/paX7IbhAec+YisqoFISnvjQ2Q1SFZy1RDy+kd2wFtQZrwRhqdmayRz pJq0i0qkXAxNO153iCJx2He/Tju1rc15LjeVZktjnnw+5Y1oOKUAnVw5CB/oHbZUhE f7hB6cV9BT4/+jKhlhl0aoBaLQh9IYsKSypuiXmV2FfxIDm7NGw7FZ/asAeI9ufuId fUdhIh204RI+5Z+9Yk7OOGOpeyNWgAUgpfX5an0mMOGRNoSsusKMItEPYjRVDTWvDz XFL+MNv/7zmd9inlA3naxUilmm4LKoYswgBJYbSo1HsuWd/F1h55QIopu5ceYVudug 3nmiuDitOrsjg== Original-Received: from alfajor (unknown [45.72.224.181]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B705412007C; Wed, 13 Jan 2021 17:25:40 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Mon, 11 Jan 2021 13:00:33 -0500") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263042 Archived-At: >> It's a different use case, and I don't think we saw any adverse >> effects there from the removal of the buffer-switch "event". >> Are there any adverse effects? > > The fact that echo-keystrokes were displayed earlier than expected was > not a serious issue, so I didn't bother to report it. But I do think > it's an adverse effect. Also, in the old code with BUFFER_SWITCH_EVENT there was the same side-effect, i.e. process output would interrupt the `sit_for` of echo-keystrokes just like my patch does. IOW, I don't think my patch is The Right Thing (because that would involve making `sit_for` loop until the end of the timeout as long as there's no pending input), but it brings back the old behavior in a "bug compatible" way. So unless there's any objection I plan to push the patch below in the coming days, Stefan diff --git a/src/dispnew.c b/src/dispnew.c index 36a6dd8a09..e603c67136 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6049,7 +6049,14 @@ DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0, READING is true if reading input. If DISPLAY_OPTION is >0 display process output while waiting. If DISPLAY_OPTION is >1 perform an initial redisplay before waiting. -*/ + + Returns a boolean Qt if we waited the full time and returns Qnil if the + wait was interrupted by incoming process output or keyboard events. + + FIXME: When `wait_reading_process_output` returns early because of + process output, instead of returning nil we should loop and wait some + more (i.e. until either there's pending input events or the timeout + expired). */ Lisp_Object sit_for (Lisp_Object timeout, bool reading, int display_option) @@ -6110,8 +6117,9 @@ sit_for (Lisp_Object timeout, bool reading, int display_option) gobble_input (); #endif - wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, - Qnil, NULL, 0); + int nbytes + = wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, + Qnil, NULL, 0); if (reading && curbuf_eq_winbuf) /* Timers and process filters/sentinels may have changed the selected @@ -6120,7 +6128,7 @@ sit_for (Lisp_Object timeout, bool reading, int display_option) buffer to start with). */ set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents)); - return detect_input_pending () ? Qnil : Qt; + return (nbytes > 0 || detect_input_pending ()) ? Qnil : Qt; }