unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 65864@debbugs.gnu.org
Cc: eliz@gnu.org, monnier@iro.umontreal.ca, mardani29@yahoo.es
Subject: bug#65864: [PATCH] Add option to save a buffer without running save hooks
Date: Wed, 13 Sep 2023 19:44:20 +0300	[thread overview]
Message-ID: <86zg1qrsxi.fsf@mail.linkov.net> (raw)
In-Reply-To: <m1h6nzke03.fsf@yahoo.es> ("Daniel Martín via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\""'s message of "Tue, 12 Sep 2023 10:11:08 +0200")

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





  parent reply	other threads:[~2023-09-13 16:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m1y1hdm2hj.fsf.ref@yahoo.es>
2023-09-11 10:24 ` bug#65864: [PATCH] Add option to save a buffer without running save hooks Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-11 12:45   ` Eli Zaretskii
2023-09-11 22:28     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-12  8:11       ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-12 12:59         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 16:44         ` Juri Linkov [this message]
2023-09-13 17:17           ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zg1qrsxi.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=65864@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=mardani29@yahoo.es \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).