[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sit-for and idle timers
From: |
Chong Yidong |
Subject: |
Re: sit-for and idle timers |
Date: |
Mon, 14 Aug 2006 16:05:58 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>> 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.