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: Juri Linkov
Subject: bug#65864: [PATCH] Add option to save a buffer without running save hooks
Date: Wed, 13 Sep 2023 19:44:20 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> 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".

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.





reply via email to

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