emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested sit-for's


From: Stefan Monnier
Subject: Re: Nested sit-for's
Date: Mon, 21 Aug 2006 12:14:18 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> IIUC, the recent addition of current-idle-time by RMS was supposed to
>> fix the sit-for in jit-lock problem in a different way.  But so far,
>> RMS' changes to jit-lock have not been installed...   What's up???
>> 
>> Someone else proposed a different change to the same part of jit-lock,
>> and I have not had time (while sufficiently alert) to study that,
>> so I don't have any idea which solution is better.
>> 
>> I sent my changes to the list yesterday; what do others think about
>> them?

> I haven't fully understood either of the two approaches, but Martin's
> approach which completely avoids using sit-for in the timer handler
> looks vastly superior to me for that reason alone!

I think we could clean up the code even more by extending
run-with-idle-timer as follows:

  (run-with-idle-timer SECS REPEAT FUNCTION &rest ARGS)

   Perform an action the next time Emacs is idle for SECS seconds.
   The action is to call function with arguments ARGS.
   SECS may be an integer or a floating point number.

   If REPEAT is non-nil, do the action each time Emacs has been idle for
   exactly SECS seconds (that is, only once for each time Emacs becomes idle).

   Additionally, if REPEAT is a number, repeat the action every REPEAT
   seconds as long as Emacs stays idle.

   This function returns a timer object which you can use in `cancel-timer'.


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]