all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Repeating timers and suspending the computer
Date: Fri, 09 Dec 2022 09:25:34 +0200	[thread overview]
Message-ID: <834ju511jl.fsf@gnu.org> (raw)
In-Reply-To: <87r0x9dug9.fsf@mbork.pl> (message from Marcin Borkowski on Fri,  09 Dec 2022 06:20:22 +0100)

> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Fri, 09 Dec 2022 06:20:22 +0100
> 
> assume that I said
> 
> (run-with-timer 0 1
>                 (lambda () (message "%s" (format-time-string "%H:%M:%S.%3N"))))
> 
> and put my laptop in the "sleep mode" for 20 seconds.  How many time
> messages should I get?  Assume `timer-max-repeats' is 10 (which seems to
> be the default).
> 
> When I did the experiment, it seemed that the timer'd function was run
> /twice/ after waking up, which looks really strange -- why two times?

I think you have some implicit mental model of what happens when the
number of delayed invocations of the timer function exceeds that
limit, a model that you didn't describe.  You seem to be assuming that
you will get those 10 invocations, and no more, is that right?  But
that is not the only possible way of dealing with this situation.  In
fact, it isn't even smart: if time has jumped far ahead, why should
Emacs give you 10 useless invocations of the timer?

Or if you were expecting something else, please tell what you expected
and why.



  reply	other threads:[~2022-12-09  7:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09  5:20 Repeating timers and suspending the computer Marcin Borkowski
2022-12-09  7:25 ` Eli Zaretskii [this message]
2022-12-10  4:48   ` Emanuel Berg
2022-12-10 21:39   ` Marcin Borkowski
2022-12-11  6:52     ` Eli Zaretskii
2022-12-13  5:16       ` Marcin Borkowski
2022-12-13 12:32         ` Eli Zaretskii
2022-12-14 20:13           ` Marcin Borkowski
2022-12-15  6:11             ` Eli Zaretskii
2022-12-15 15:28               ` Marcin Borkowski

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834ju511jl.fsf@gnu.org \
    --to=eliz@gnu.org \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.