unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: philip@warpmail.net (Philip K.)
To: 41060@debbugs.gnu.org
Subject: bug#41060: [PATCH] Use write-region when saving recentf file
Date: Sun, 03 May 2020 18:43:01 +0200	[thread overview]
Message-ID: <87zhapx94a.fsf@bulbul> (raw)

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]


I've been playing around with enabling "version-control" for backups,
and what I have been noticing is that the ~/.emacs.d/recentf file has
had a lot of backups, far more that regular files that I use. My
understanding is that this happens because recentf currently uses
write-file (that in turn uses the backup'ing save-buffer) instead of
directly writing the temporary buffer to the disk.

This patch does just that, replacing write-file with write-region,
because I argue that an automatically generated file doesn't need
backups.

-- 
	Philip K.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-write-region-when-saving-recentf-file.patch --]
[-- Type: text/x-diff, Size: 906 bytes --]

>From 25700db3f6e8e282f86f1cd3ccc77250834fb7a0 Mon Sep 17 00:00:00 2001
From: Philip K <philip@warpmail.net>
Date: Sun, 3 May 2020 01:13:31 +0200
Subject: [PATCH] Use write-region when saving recentf file

---
 lisp/recentf.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/recentf.el b/lisp/recentf.el
index 27918a9739..877edd4be1 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -1289,7 +1289,8 @@ recentf-save-list
         (insert "\n\f\n;; Local Variables:\n"
                 (format ";; coding: %s\n" recentf-save-file-coding-system)
                 ";; End:\n")
-        (write-file (expand-file-name recentf-save-file))
+        (write-region (point-min) (point-max)
+                      (expand-file-name recentf-save-file))
         (when recentf-save-file-modes
           (set-file-modes recentf-save-file recentf-save-file-modes))
         nil)
-- 
2.20.1


             reply	other threads:[~2020-05-03 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 16:43 Philip K. [this message]
2020-05-03 19:23 ` bug#41060: [PATCH] Use write-region when saving recentf file Eli Zaretskii
2020-05-03 21:22   ` Philip K.
2020-05-05  2:48 ` Richard Stallman
2020-08-08 12:00 ` Lars Ingebrigtsen

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=87zhapx94a.fsf@bulbul \
    --to=philip@warpmail.net \
    --cc=41060@debbugs.gnu.org \
    /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).