From: Christopher Howard <christopher@librehacker.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Timers for weekly events
Date: Wed, 24 Jul 2024 13:28:23 -0800 [thread overview]
Message-ID: <87bk2m32fc.fsf@librehacker.com> (raw)
In-Reply-To: Eli Zaretskii's message of "Wed, 24 Jul 2024 21:38:40 +0300 (2 hours, 23 minutes, 19 seconds ago)"
> I suggest to take a look at midnight.el, it solves a very similar
> problem: how to run a function at midnight of every day (or at a
> user-defined offset from midnight). It sounds like you want to do
> something very similar, except in your case the function should run
> once every 7 days, not once per day.
I see that `midnight-next' function does a similar calculation to the one my function does, though simpler because it only has to calculate seconds to the next midnight. I could see how midnight mode could be used to drive weekly events. The main downsides to this approach I'm seeing are (1) if you want events to occur at various times of day, the functions you pass in must launch their own timers with the offset time amount; (2) your timers wouldn't launch until at least midnight, if you had just (re)started Emacs; (3) `list-timers' wouldn't necessarily show all forth-coming timer events, only those timers that had already been launched in the midnight hook; (4) Your functions would still need to check what day it is. So, I'll keep using my function for now, though maybe rename it to `wee
kly-next'. I'm still not sure where weekly-next would fit amongst the Emacs libraries, though timer.el still seems the most likely candidate.
--
Christopher Howard
next reply other threads:[~2024-07-24 21:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 21:28 Christopher Howard [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-07-26 16:23 Timers for weekly events Christopher Howard
2024-07-26 16:37 ` Michael Heerdegen via Emacs development discussions.
2024-07-26 19:53 ` James Thomas
2024-07-26 15:01 Christopher Howard
2024-07-26 16:01 ` Michael Heerdegen via Emacs development discussions.
2024-07-24 17:35 Christopher Howard
2024-07-24 18:38 ` Eli Zaretskii
2024-07-24 23:44 ` James Thomas
2024-07-24 16:28 Christopher Howard
2024-07-24 16:45 ` 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
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=87bk2m32fc.fsf@librehacker.com \
--to=christopher@librehacker.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).