unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41060: [PATCH] Use write-region when saving recentf file
@ 2020-05-03 16:43 Philip K.
  2020-05-03 19:23 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philip K. @ 2020-05-03 16:43 UTC (permalink / raw)
  To: 41060

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-08 12:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-03 16:43 bug#41060: [PATCH] Use write-region when saving recentf file Philip K.
2020-05-03 19:23 ` Eli Zaretskii
2020-05-03 21:22   ` Philip K.
2020-05-05  2:48 ` Richard Stallman
2020-08-08 12:00 ` Lars Ingebrigtsen

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