GNU bug report logs - #41060
[PATCH] Use write-region when saving recentf file

Previous Next

Package: emacs;

Reported by: philip <at> warpmail.net (Philip K.)

Date: Sun, 3 May 2020 19:15:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41060 in the body.
You can then email your comments to 41060 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41060; Package emacs. (Sun, 03 May 2020 19:15:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to philip <at> warpmail.net (Philip K.):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 03 May 2020 19:15:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: philip <at> warpmail.net (Philip K.)
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Use write-region when saving recentf file
Date: Sun, 03 May 2020 18:43:01 +0200
[Message part 1 (text/plain, inline)]
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.

[0001-Use-write-region-when-saving-recentf-file.patch (text/x-diff, inline)]
>From 25700db3f6e8e282f86f1cd3ccc77250834fb7a0 Mon Sep 17 00:00:00 2001
From: Philip K <philip <at> 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\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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41060; Package emacs. (Sun, 03 May 2020 19:24:02 GMT) Full text and rfc822 format available.

Message #8 received at 41060 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: philip <at> warpmail.net (Philip K.)
Cc: 41060 <at> debbugs.gnu.org
Subject: Re: bug#41060: [PATCH] Use write-region when saving recentf file
Date: Sun, 03 May 2020 22:23:39 +0300
> From: philip <at> warpmail.net (Philip K.)
> Date: Sun, 03 May 2020 18:43:01 +0200
> 
> This patch does just that, replacing write-file with write-region,
> because I argue that an automatically generated file doesn't need
> backups.

Not even one backup?

Also, why impose this change on everyone, when backups for a specific
file can be disabled by the user at will?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41060; Package emacs. (Sun, 03 May 2020 21:23:02 GMT) Full text and rfc822 format available.

Message #11 received at 41060 <at> debbugs.gnu.org (full text, mbox):

From: philip <at> warpmail.net (Philip K.)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 41060 <at> debbugs.gnu.org
Subject: Re: bug#41060: [PATCH] Use write-region when saving recentf file
Date: Sun, 03 May 2020 23:22:48 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: philip <at> warpmail.net (Philip K.)
>> Date: Sun, 03 May 2020 18:43:01 +0200
>> 
>> This patch does just that, replacing write-file with write-region,
>> because I argue that an automatically generated file doesn't need
>> backups.
>
> Not even one backup?

No, as seems to be the default with other auto-generated files.

> Also, why impose this change on everyone, when backups for a specific
> file can be disabled by the user at will?

I understand the argument, but I don't see why anyone would be
interested in backups for a file they don't actually visit + it's
appears to be inconsistent behaviour, as mentioned above.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41060; Package emacs. (Tue, 05 May 2020 02:50:02 GMT) Full text and rfc822 format available.

Message #14 received at 41060 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: philip <at> warpmail.net (Philip K.)
Cc: 41060 <at> debbugs.gnu.org
Subject: Re: bug#41060: [PATCH] Use write-region when saving recentf file
Date: Mon, 04 May 2020 22:48:56 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I agree there is no need for a backup file for the list of recent
files.  It is no big deal not to have that feature.  It is merely a
minor convenience.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41060; Package emacs. (Sat, 08 Aug 2020 12:01:02 GMT) Full text and rfc822 format available.

Message #17 received at 41060 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: philip <at> warpmail.net (Philip K.)
Cc: 41060 <at> debbugs.gnu.org
Subject: Re: bug#41060: [PATCH] Use write-region when saving recentf file
Date: Sat, 08 Aug 2020 14:00:18 +0200
philip <at> warpmail.net (Philip K.) writes:

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

Eli was against it, but Richard was for it, and it does seem
inconsistent with how Emacs does it with other files, so I went ahead
and applied it.

Feel free to revert if anybody strenuously disagrees with this. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 12:01:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 41060 <at> debbugs.gnu.org and philip <at> warpmail.net (Philip K.) Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 12:01:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Sep 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.