all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Christopher Howard <christopher@librehacker.com>
Cc: 71699@debbugs.gnu.org
Subject: bug#71699: 29.3; run-at-time early run
Date: Fri, 21 Jun 2024 21:57:28 +0300	[thread overview]
Message-ID: <86wmmijf8n.fsf@gnu.org> (raw)
In-Reply-To: <87y16y5jni.fsf@librehacker.com> (message from Christopher Howard on Fri, 21 Jun 2024 08:45:53 -0800)

> From: Christopher Howard <christopher@librehacker.com>
> Date: Fri, 21 Jun 2024 08:45:53 -0800
> 
> 
> emacs -Q
> M-x eval-expression
> (run-at-time "04:00" 86400 (lambda () (message "timer ran")))
> 
> >From the documentation, I expect this lambda to run in the future, at 4:00 in the morning. However, it also runs once when I first eval this run-at-time expression, i.e., when I setup the timer. From looking at list-timers, I can see that it will run again at 4 in the morning, which is good, but I do not want the function to run when the timer is first setup.
> 
> I tried a different approach, passing in a named function instead of a lambda, but got the same result.

I guess you evaluated the expression at time that was after 4AM that
day?  If so, this is expected behavior, because times are interpreted
as times _today_.  The ELisp manual says:

 -- Command: run-at-time time repeat function &rest args
     This sets up a timer that calls the function FUNCTION with
     arguments ARGS at time TIME.  If REPEAT is a number (integer or
     floating point), the timer is scheduled to run again every REPEAT
     seconds after TIME.  If REPEAT is ‘nil’, the timer runs only once.

     TIME may specify an absolute or a relative time.

     Absolute times may be specified using a string with a limited
     variety of formats, and are taken to be times _today_, even if
     already in the past.  The recognized forms are ‘XXXX’, ‘X:XX’, or
     ‘XX:XX’ (military time), and ‘XXam’, ‘XXAM’, ‘XXpm’, ‘XXPM’,
     ‘XX:XXam’, ‘XX:XXAM’, ‘XX:XXpm’, or ‘XX:XXPM’.

So I don't think this is a bug.





  reply	other threads:[~2024-06-21 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 16:45 bug#71699: 29.3; run-at-time early run Christopher Howard
2024-06-21 18:57 ` Eli Zaretskii [this message]
     [not found]   ` <87msne5aup.fsf@librehacker.com>
2024-06-22  6:14     ` Eli Zaretskii

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=86wmmijf8n.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71699@debbugs.gnu.org \
    --cc=christopher@librehacker.com \
    /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.