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

From: Dmitry Gutov <[email-masked]>
Date: Wed, 19 Sep 2012 20:21:32 +0400

On 19.09.2012 19:24, Eli Zaretskii wrote:
>> Date: Wed, 19 Sep 2012 13:54:39 +0400
>> From: Dmitry Gutov <[email-masked]>
>> CC: [email-masked], [email-masked], [email-masked]
>>
>> On 19.09.2012 6:54, Eli Zaretskii wrote:
>>>> I'll keep the workaround, though, as it reportedly also fixes the
>>>> long-standing OS X freeze bug.
>>>
>>> What workaround is that?
>>
>> The one I posted in #12326: calling timer-activate-when-idle with nil
>> DONT-WAIT argument.
>
> I don't think that's a workaround.  I think that's what js2 should do,
> if (AFAIU) it wants the timer handler be invoked once, after Emacs has
> been idle for more than 1 sec.

Maybe, but run-with-idle-timer calls it with DONT-WAIT t, and 
js2-mode-reset-timer is only supposed to be called in response to some 
user action.
So with your patch, it works effectively the same either way.

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?

Below that, the docstring mentions what will happen if Emacs has been 
idle for N seconds (N < SECS), but doesn't clarify that if N => SECS, it 
will fire immediately.

>> https://github.com/mooz/js2-mode/commit/b02f4a0d72d0e2087038fe891e2580c4505415ef
>
> Btw, in this line:
>
>    (timer-activate-when-idle timer nil)))
>
> I think you can lose the last argument, since it is optional anyway.

Sure, I wrote it that way just to be explicit.