Subject: bug#78820: 31.0.50; savehist timer does not run repeatedly

From: Daniel Mendler <[email-masked]>
Date: Wed, 18 Jun 2025 14:20:11 +0200

Stéphane Marks <[email-masked]> writes:

> On Wed, Jun 18, 2025 at 7:55 AM Eli Zaretskii <[email-masked]> wrote:
>
>> > Cc: "Stefan Monnier" <[email-masked]>
>> > Date: Wed, 18 Jun 2025 02:23:14 +0200
>> > From:  Daniel Mendler via "Bug reports for GNU Emacs,
>> >  the Swiss army knife of text editors" <[email-masked]>
>> >
>> > It seems that the savehist timer does not run repeatedly. run-with-timer
>> > is called with repeat argument t.
>> >
>> > (run-with-timer savehist-autosave-interval t #'savehist-autosave)
>> >
>> > If I understand correctly, the correct call should look like this:
>> >
>> > (run-with-timer t savehist-autosave-interval #'savehist-autosave)
>> > (run-with-timer savehist-autosave-interval savehist-autosave-interval
>> #'savehist-autosave)
>>
>> Why do you think so?  The calling sequence of run-with-timer is this:
>>
>>   (run-with-timer SECS REPEAT FUNCTION &rest ARGS)
>>
>> So what savehist.el does appears to be correct.  Or what am I missing?
>>
>
> (defun savehist--manage-timer ()
> ;; should be
>    (run-with-timer savehist-autosave-interval
>                    savehist-autosave-interval #'savehist-autosave))
> ;; not silly t
>    (run-with-timer savehist-autosave-interval t #'savehist-autosave))

To clarify, with the argument t, the timer does not run repeatedly, but
only once. That's the problem. Btw I wonder if it would make sense to
allow Stéphane's calling convention too and just dtrt. It is not
obviously silly imo.

Daniel