From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: sit-for and idle timers Date: Mon, 14 Aug 2006 16:05:58 -0400 Message-ID: <87irkvxeu1.fsf@stupidchicken.com> References: <20060811124841.840381.FMU5696@piglet.prv.splode.com> <87odun6qx0.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155585906 19856 80.91.229.2 (14 Aug 2006 20:05:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 14 Aug 2006 20:05:06 +0000 (UTC) Cc: Noah Friedman , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 14 22:05:05 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GCigF-00039G-QI for ged-emacs-devel@m.gmane.org; Mon, 14 Aug 2006 22:05:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GCigF-00035P-5k for ged-emacs-devel@m.gmane.org; Mon, 14 Aug 2006 16:04:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GCig1-00035K-U0 for emacs-devel@gnu.org; Mon, 14 Aug 2006 16:04:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GCifz-000358-Fx for emacs-devel@gnu.org; Mon, 14 Aug 2006 16:04:44 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GCifz-000355-Cf for emacs-devel@gnu.org; Mon, 14 Aug 2006 16:04:43 -0400 Original-Received: from [18.19.1.138] (helo=cyd) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GCilq-00042F-7A; Mon, 14 Aug 2006 16:10:46 -0400 Original-Received: by cyd (Postfix, from userid 1000) id B156F4E2D1; Mon, 14 Aug 2006 16:05:58 -0400 (EDT) Original-To: rms@gnu.org In-Reply-To: <87odun6qx0.fsf@stupidchicken.com> (Chong Yidong's message of "Mon, 14 Aug 2006 15:47:07 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58393 Archived-At: >> That is definitely not right. Emacs really is idle when it reads an event, >> even if there is a timeout. >> >> So my conclusion is that when read-event is called from an idle timer, >> it should not change the state to idle at the beginning, and it should >> not change the state away from idle at the end. > > I already checked in a different change to keyboard.c before your > email came in. But I think your version makes more sense. I just thought of one inconsistency, though. Suppose Emacs is not idle, and is running Lisp code that calls sit-for. With your change, this starts idle timers: ! if (! already_idle) ! timer_start_idle (); This is inconsistent with the old (built-in) behavior of sit-for, which did not activate idle timers while waiting either. The reasoning, I think, is that `sit-for' means for the Lisp code to "spin" for that period of time or until input arrives, which is not the same as idling. (This is similar to why `sleep-for' does not run idle timers.) If this is the intended behavior, then read-event with a timeout should not start idle timers, since it only exists to be called by sit-for. We could simply document this behavior in the lispref manual.