GNU bug report logs -
#65864
[PATCH] Add option to save a buffer without running save hooks
Previous Next
Full log
Message #46 received at 65864 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> 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`.
Yes, it does seem like a sharp tool. OTOH, we have some of them in
Emacs already. Maybe we could make disabled-command cover it, somehow?
> Maybe the time-stamp package should instead provide a prefix command
> `time-stamp-inhibit` which makes the next call to `time-stamp`
> do nothing.
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.
I have also seen variations on hooks like these recommended online:
(delete-trailing-whitespace time-stamp
my-recompile-el check-parens)
Where `my-recompile-el` is some function that would automatically
recompile the file.
In cases such as these, the prefix argument would mean "just save this
file now without doing any other special processing".
That said, if this functionality is not considered generally useful, I'm
of course happy to add it to my local hacks and move on.
> 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`.
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?
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.