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

* bug#41060: [PATCH] Use write-region when saving recentf file
  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
  2 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-05-03 19:23 UTC (permalink / raw)
  To: Philip K.; +Cc: 41060

> From: philip@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?





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

* bug#41060: [PATCH] Use write-region when saving recentf file
  2020-05-03 19:23 ` Eli Zaretskii
@ 2020-05-03 21:22   ` Philip K.
  0 siblings, 0 replies; 5+ messages in thread
From: Philip K. @ 2020-05-03 21:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 41060

Eli Zaretskii <eliz@gnu.org> writes:

>> From: philip@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.





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

* bug#41060: [PATCH] Use write-region when saving recentf file
  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-05  2:48 ` Richard Stallman
  2020-08-08 12:00 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2020-05-05  2:48 UTC (permalink / raw)
  To: Philip K.; +Cc: 41060

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







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

* bug#41060: [PATCH] Use write-region when saving recentf file
  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-05  2:48 ` Richard Stallman
@ 2020-08-08 12:00 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-08 12:00 UTC (permalink / raw)
  To: Philip K.; +Cc: 41060

philip@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





^ permalink raw reply	[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).