GNU bug report logs - #12507
24.2.50; `bookmark-write-file': use `write-file', not `write-region', to get backups

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 24 Sep 2012 18:44:01 UTC

Severity: wishlist

Tags: notabug

Found in version 24.2.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Thierry Volpiatto'" <thierry.volpiatto <at> gmail.com>
Cc: 'Karl Fogel' <kfogel <at> red-bean.com>, 'Stefan Monnier' <monnier <at> iro.umontreal.ca>, 12507 <at> debbugs.gnu.org
Subject: bug#12507: [debbugs-tracker] Processed: severity 12507 wishlist
Date: Sat, 29 Sep 2012 08:51:34 -0700
> >> > The question about visiting the file is still open, though.
> >>
> >> I am using now the patch I sent here yesterday and it works 
> >> really good, faster and do backups (numered) as expected.
> >> Hope it will be applied here in emacs because it DTRT.
> >> 
> >> I don't understand what is the problem with "visiting the
> >> file". See in precedent post why it is not bad visiting the
> >> file. In the special case of bookmark-write-file, it is
> >> really not the problem.
> >
> > Your question is for Stefan.  Your patch is equivalent to
> > the change I proposed originally: just replace
> > `write-region' with `write-file'.
>
> No, this is ineficient too, you write twice the same data.

How so?  What am I missing?  What part of `write-file' writes the same data
twice?  All I see in the `write-file' definition, in terms of writing, is a call
to `save-buffer'.

> The important thing is writing directly to the buffer of file.
> For the backup thing, yes it is similar, but with unneeded steps,

Steps that you seem to claim constitute an additional disk write.  I don't see
that.  What part of `write-file' performs an extra disk write?

The only "extra" steps I see in `write-file' are setting the visited file name,
setting the buffer status to modified, checking that the file is
`file-writable-p', and setting `buffer-read-only' to nil.  And running
`vc-find-file-hook'.

You are, I think, side-tracking the issue a bit.  The question to be decided is
whether to allow backups.  It is not whether to use `write-file', `save-buffer',
`basic-save-buffer', or something else.  I don't really care exactly how it's
done.  I have confidence it will be done efficiently if it is decided to be
done.

> going straight to save-buffer is better and faster IMO (of 
> course if you have started writing data in the file buffer)
> 
> But the worst thing is the actual version with write-region:
> Slow and backup broken.

I don't see that the current version is slow, either.  But it certainly does not
provide for backing up.  That is the question to be decided.





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

Previous Next


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