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

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

Re: Repeating timers and suspending the computer


From: Eli Zaretskii
Subject: Re: Repeating timers and suspending the computer
Date: Tue, 13 Dec 2022 14:32:12 +0200

> From: Marcin Borkowski <mbork@mbork.pl>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 13 Dec 2022 06:16:53 +0100
> 
> ;; If real time has jumped forward,
> ;; perhaps because Emacs was suspended for a long time,
> ;; limit how many times things get repeated.
> (if (and (numberp timer-max-repeats)
>          (time-less-p (timer--time timer) nil))
>     (let ((repeats (/ (timer-until timer nil)
>                       (timer--repeat-delay timer))))
>       (if (> repeats timer-max-repeats)
>           (timer-inc-time timer (* (timer--repeat-delay timer)
>                                    repeats)))))
> --8<---------------cut here---------------end--------------->8---
> 
> Do I get it correctly that this means that of the scheduled number of
> repeats is /less/ than `timer-max-repeats', then all of them get
> executed, but when it is greater than that, only one of them is?

That's the idea, yes.



reply via email to

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