Subject: bug#12447: 24.1.50; Stuck in garbage collection on OS X

From: Chong Yidong <[email-masked]>
Date: Thu, 20 Sep 2012 12:04:51 +0800

Eli Zaretskii <[email-masked]> writes:

>> Date: Wed, 19 Sep 2012 20:21:32 +0400
>> From: Dmitry Gutov <[email-masked]>
>> CC: [email-masked], [email-masked], [email-masked]
>> 
>> By the way, here's what run-with-idle-timer docstring says:
>> "Perform an action the next time Emacs is idle for SECS seconds."
>> 
>> Shouldn't this mean that it should also pass DONT-WAIT nil?
>
> No, it just means no one considered the possibility that an idle timer
> will re-invoke itself like that.  IOW, the doc string is inaccurate.

I'm not 100% sure this is merely a doc string problem.  In the face of
ambiguity, we should try to choose the behavior that is least likely to
lead to infloops in user code.

When `run-with-idle-timer' is called from an idle timer, we could
interpret it to mean "run the function the next time Emacs becomes idle
for SECS seconds, not including the current period of idleness".

Such behavior seems quite reasonable.  And it is of course easy to
implement, by simply making `run-with-idle-timer' check if it is running
while idle and, if so, giving a nil second arg to
`timer-activate-by-idle'.