From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#65864: [PATCH] Add option to save a buffer without running save hooks Date: Wed, 13 Sep 2023 19:44:20 +0300 Organization: LINKOV.NET Message-ID: <86zg1qrsxi.fsf@mail.linkov.net> References: <83h6o0ri8c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38841"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: eliz@gnu.org, monnier@iro.umontreal.ca, mardani29@yahoo.es To: 65864@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 13 18:50:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qgT4R-0009rB-FW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Sep 2023 18:50:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgT3z-00086Q-8N; Wed, 13 Sep 2023 12:50:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgT3u-00083N-2t for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 12:49:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgT3t-0002ye-9J for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 12:49:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qgT3y-0002DV-J8 for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 12:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2023 16:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65864 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 65864@debbugs.gnu.org, eliz@gnu.org, monnier@iro.umontreal.ca, Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Received: via spool by 65864-submit@debbugs.gnu.org id=B65864.16946237718452 (code B ref 65864); Wed, 13 Sep 2023 16:50:02 +0000 Original-Received: (at 65864) by debbugs.gnu.org; 13 Sep 2023 16:49:31 +0000 Original-Received: from localhost ([127.0.0.1]:35812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgT3S-0002CF-Mf for submit@debbugs.gnu.org; Wed, 13 Sep 2023 12:49:31 -0400 Original-Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:43579) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgT3Q-0002Bp-9x for 65864@debbugs.gnu.org; Wed, 13 Sep 2023 12:49:29 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 6C4D21C0004; Wed, 13 Sep 2023 16:49:13 +0000 (UTC) In-Reply-To: ("Daniel =?UTF-8?Q?Mart=C3=ADn?= via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\""'s message of "Tue, 12 Sep 2023 10:11:08 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270337 Archived-At: > 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.