bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Daniel Martín
Subject: bug#65864: [PATCH] Add option to save a buffer without running save hooks
Date: Tue, 12 Sep 2023 10:11:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

>>> Users can customize `before-save-hook' to add things like
>>> `delete-trailing-whitespace' or `copyright-update'.  However, there are
>>> cases where you want to save a buffer without running any save hooks
>>> without changing your configuration and then changing it back.
>
> Do you have concrete examples, to helps us assess what's really at stake
> here?  Maybe there are other ways to look at the problem :-)
>

For example, I have `delete-trailing-whitespace' in my
`before-save-hook', but for a particular buffer I wanted to save it
without removing the trailing whitespace, because trailing whitespace
was syntactically meaningful in that case (the buffer contained some
Markdown-like source code).

I searched the Internet for some solutions and what I ended up doing is
C-x C-q (to make the buffer read-only), C-x C-s, and C-x C-q to make the
buffer writable again (from
https://stackoverflow.com/questions/14913398/in-emacs-how-do-i-save-without-running-save-hooks).
It felt a bit like a "hack".




reply via email to

[Prev in Thread] Current Thread [Next in Thread]