Subject: bug#65864: [PATCH] Add option to save a buffer without running save hooks

From: Ship Mints <[email-masked]>
Date: Wed, 12 Feb 2025 09:06:02 -0500

That might interfere with prefix args people have set up for their own
saves. How about a new time-stamp-inhibit defvar which people can bind to t
in their own save-buffer wrapper they bind to C-x C-s?

On Wed, Feb 12, 2025 at 9:02 AM Stefan Monnier via Bug reports for GNU
Emacs, the Swiss army knife of text editors <[email-masked]> wrote:

> >> >> I confirm that 'C-u - C-x C-s' will save me from trouble that I have
> with
> >> >>
> >> >>   (add-hook 'before-save-hook 'time-stamp nil t)
> >> >>
> >> >> because often I don't need to update the timestamp for a small fix.
> >> >> It takes too much time to revisit the file with M-x
> find-file-literally,
> >> >> then manually restore the previous timestamp (to not commit
> unnecessary change),
> >> >> and save the file again.  Your patch will help substantially, thanks
> for this.
> >> >
> >> > Same here, FWIW.
> >>
> >> Does anyone object to installing this patch?
> >
> > I don't necessarily object, but how can we usefully document this
> > behavior? who are those users that know by heart the hooks run by
> > save-buffer?  And without knowing that, how can a user decide whether
> > she does or doesn't want to use this feature: perhaps omitting some
> > hook disables behavior that is very important to the user?
>
> It does seem like a blunt way to affect `time-stamp`.
>
> Maybe the time-stamp package should instead provide a prefix command
> `time-stamp-inhibit` which makes the next call to `time-stamp`
> do nothing.
>
> Or a more hackish way would be for `time-stamp` to consult
> `current-prefix-arg`, so as to disable the update of the time stamp when
> you do `C-u - C-x C-s`.
>
>
>         Stefan
>
>
>
>
>