all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 73291@debbugs.gnu.org, manuel@ledu-giraud.fr
Subject: bug#73291: 31.0.50; `clean-buffer-list' activates `midnight-mode'
Date: Tue, 17 Sep 2024 16:46:02 +0300	[thread overview]
Message-ID: <868qvqbdgl.fsf@gnu.org> (raw)
In-Reply-To: <87frpyh11i.fsf@web.de> (message from Michael Heerdegen on Tue, 17 Sep 2024 15:17:45 +0200)

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: Eli Zaretskii <eliz@gnu.org>,  Manuel Giraud <manuel@ledu-giraud.fr>,
>   73291@debbugs.gnu.org
> Date: Tue, 17 Sep 2024 15:17:45 +0200
> 
> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
> 
> > > -  (when (timerp midnight-timer) (cancel-timer midnight-timer))
> > > -  (setq midnight-timer
> > > -        (run-at-time (if (numberp tm) (+ (midnight-next) tm) tm)
> > > -                     midnight-period #'run-hooks 'midnight-hook)))
> > > +  (when (timerp midnight-timer)
> > > +    (cancel-timer midnight-timer)
> > > +    (setq midnight-timer
> > > +          (run-at-time (if (numberp tm) (+ (midnight-next) tm) tm)
> > > +                       midnight-period #'run-hooks 'midnight-hook))))
> > >
> > >  (defcustom midnight-delay 3600
> > >    "The number of seconds after the midnight when the `midnight-timer' is run.
> > >
> > > Can you try this and see if it solves the problem, and doesn't break
> > > the other uses of midnight-mode and or clean-buffer-list?
> >
> > Thanks.  It solves the issue of activacting the midnight-mode: now
> > `clean-buffer-list' is just done once and won't run the next day.  But
> > now, when I do M-x midnight-mode, I get the following error:
> >
> > timer--activate: Invalid or uninitialized timer
> 
> Maybe we could instead check whether `midnight-mode' is on, Eli?

Sorry, I don't understand what you have in mind: check where?

What needs to be done is to make sure midnight-timer is a timer
(calling timer-create if not) before we call midnight-delay-set,
because it will only initialize the delay if midnight-timer is already
a timer.

Alternatively, we could call run-at-time directly from midnight-mode.

But I guess you meant some third possibility?





  reply	other threads:[~2024-09-17 13:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16  7:49 bug#73291: 31.0.50; `clean-buffer-list' activates `midnight-mode' Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-16 13:09 ` Eli Zaretskii
2024-09-17  8:19   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 12:50     ` Eli Zaretskii
2024-09-17 13:15       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 13:17     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 13:46       ` Eli Zaretskii [this message]
2024-09-17 19:07         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 19:26           ` Eli Zaretskii
2024-09-18  9:06             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-18 23:52               ` Stefan Kangas
2024-09-19  5:53                 ` Eli Zaretskii
2024-09-21  0:27                   ` Stefan Kangas
2024-09-21 12:55                     ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-21 13:04                       ` Stefan Kangas

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=868qvqbdgl.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73291@debbugs.gnu.org \
    --cc=manuel@ledu-giraud.fr \
    --cc=michael_heerdegen@web.de \
    /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.