[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: run-with-idle-timer vs. run-at-time
From: |
Óscar Fuentes |
Subject: |
Re: run-with-idle-timer vs. run-at-time |
Date: |
Mon, 15 Feb 2021 20:33:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Möding <s.moeding@gmail.com> writes:
> I'm trying to understand the difference between these two timers:
>
> (run-with-idle-timer 0 nil (lambda () (...)))
>
> (run-at-time 0 nil (lambda () (...)))
>
> I suspect there is a difference (see below) but I'm unable to come up with
> an example where it actually makes a difference. Does anybody have an idea
> what condition could cause a different behavior?
>
> I can see from the documentation that `run-with-idle-timer' runs when
> Emacs is waiting for input. But that also seems to be the case for
> `run-at-time'. Is there a way that `run-at-time' might run at a time
> (earlier) when `run-with-idle-timer' would not?
Put this code in *scratch*, evaluate it and look at the contents of
*Messages*:
(progn
(sleep-for 1)
(run-at-time 0 nil 'message "running at time")
(run-with-idle-timer 0 nil 'message "running at idle time")
(sleep-for 1)
(message "after run at time")
(message ""))