help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: run-with-idle-timer vs. run-at-time


From: Stefan Möding
Subject: Re: run-with-idle-timer vs. run-at-time
Date: Tue, 16 Feb 2021 07:50:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)

Óscar Fuentes <ofv@wanadoo.es> writes:

> (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 ""))

Thank you!  Now it makes sense!

Interesting: With (sleep-for 0) both timer are executed after the block.
But with (sit-for 0) the output of the run-at-time is also interleaved.
According to the docs (redisplay) is the same as (sit-for 0) and indeed
this behaves the same.

This could be the root cause for my problem.  Some code in the mode hook
runs (redisplay) or (sit-for 0) leading to a premature execution of the
timer.

Very helpful!  Thanks again!

-- 
Stefan



reply via email to

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