From: "Óscar Fuentes" <ofv@wanadoo.es>
To: help-gnu-emacs@gnu.org
Subject: Re: run-with-idle-timer vs. run-at-time
Date: Mon, 15 Feb 2021 20:33:31 +0100 [thread overview]
Message-ID: <87a6s5gm7o.fsf@telefonica.net> (raw)
In-Reply-To: m24kid87sm.fsf@athena.moeding.net
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 ""))
next prev parent reply other threads:[~2021-02-15 19:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-15 19:12 run-with-idle-timer vs. run-at-time Stefan Möding
2021-02-15 19:33 ` Óscar Fuentes [this message]
2021-02-16 6:50 ` Stefan Möding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6s5gm7o.fsf@telefonica.net \
--to=ofv@wanadoo.es \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).