Subject: RE: bug#12507: [debbugs-tracker] Processed: severity 12507 wishlist

From: "Drew Adams" <[email-masked]>
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.