GNU bug report logs - #65864
[PATCH] Add option to save a buffer without running save hooks

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Mon, 11 Sep 2023 10:28:02 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 65864 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, mardani29 <at> yahoo.es, juri <at> linkov.net
Subject: bug#65864: [PATCH] Add option to save a buffer without running save hooks
Date: Wed, 12 Feb 2025 10:51:56 -0500
> My use case for disabling `before-save-hook` with a prefix argument is
> that in `emacs-lisp-mode`, I have this `before-save-hook`:
>
>     (aggressive-indent--process-changed-list-and-indent
>      ws-butler-before-save time-stamp)
>
> Sometimes, I would really like to disable all three when saving.
> Now, I can of course disable the modes, run special commands for
> time-stamp, and so on.  It just seems less convenient.

Maybe a `grep before-save-hook Emacs (Non)GNU ELPA MELPA` would be
a good way to see how whether `before-save-hook` is used only for such
"optional" functionality, which would be a good argument in favor of the
patch (tho I'd then update the doc of `before-save-hook` to mention that
it's not guaranteed it's run, so it's meant for "nice to have but not
indispensable" processing).

Also, Daniel's patch does the same with `after-save-hook` so we'd need
to do the same analysis with that hook.

> That could work, but yes hackish, and wouldn't it mean that we'd have to
> potentially reproduce the hack in `ws-butler-mode`, `check-parens`,
> `delete-trailing-whitespace`, and so on?

Maybe.  Then again, if people have `time-stamp` and `check-parens` on
their hook and they use `C-u - C-x C-s` to "save without bumping
time-stamp", they might be disappointed if the parens happen to be
unbalanced.


        Stefan





This bug report was last modified 122 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.