|
From: | Rudolf Schlatte |
Subject: | Re: Why doesn't Emacs have an `active-timer-p' command, or why can't I find it? |
Date: | Fri, 12 Nov 2021 14:13:00 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) |
Lars Ingebrigtsen <larsi@gnus.org> writes: > Óscar Fuentes <ofv@wanadoo.es> writes: > >> An implementation would be >> >> (defun timer-active-p (timer) >> (timer--check timer) >> (or (memq timer timer-list)) >> (memq timer timer-idle-list)) > > Sounds useful to me. Of course, the form (when (timer-active-p my-timer) (do-something-that-errors-when-timer-inactive my-timer)) can still throw an error, since the return value of `timer-active-p' is outdated as soon as the function returns.. (Or can timers only fire when Emacs is otherwise idle?) Rudi
[Prev in Thread] | Current Thread | [Next in Thread] |