[Top][All Lists]

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

Re: run-with-timer vs run-with-idle-timer

From: João Távora
Subject: Re: run-with-timer vs run-with-idle-timer
Date: Wed, 9 May 2018 21:18:02 +0100

On Wed, May 9, 2018 at 9:00 PM, Davis Herring <address@hidden> wrote:
>>> An idle timer set for 600 seconds will run when ten minutes have
>>> elapsed since the last user command was finished, even if subprocess
>>> output has been accepted thousands of times within those ten minutes,
>>> and even if there have been garbage collections and autosaves.
>> Doesn't this contradict what you told me first?  I.e doesn't this
>> contradict the fact that this never returns?
>>    (catch 'done
>>      (run-with-idle-timer 600 nil (lambda () (throw 'done nil)))
>>      (while t (accept-process-output nil 0.1))) ; 6 thousand times
>> or should the manual be saying "even if subprocesses output has been
>> non-explictly accepted thousands of times"?
> No, because whatever command you used to invoke that code (C-x C-e in the trivial case) doesn't finish unless and until the loop finishes.  So no time has yet "elapsed since the last user command was finished", regardless of anything about subprocesses.


 1 nil
 (lambda ()
   (catch 'done
     (run-with-idle-timer 3 nil (lambda () (throw 'done nil)))
     (while t (accept-process-output nil 0.1)))
   (message "ok!")))

Does print "ok". However this blocks typing for 3 seconds. So in a way,
it forces idleness. Gross idea anyway. Wonder what happens in the filter...


reply via email to

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