[gnu.emacs.bug] A irritating "feature" of basic-save-buffer.

paul@moncam.co.uk (Paul Hudson) (07/20/89)

basic-save-buffer causes the modes of the saved file to be the same as
the modes that the disk file before the save. Normally, this is
exactly what you want.

But it also does this even when one of the write-file-hooks returns
non-nil to indicate that the save has been done. This can be a pain in the neck.

I've been modifying the recently posted sccs.el, which adds a
write-file-hook to perform a delta on the file.

The sequence of operations is like this.

If modified, write the buffer.
Call "delta" - file has now gone.
Call "get"   - a copy of the file now exists on the disk with modes -r--r--r--.
Call revert-buffer to get the buffer contents in sync with the disk.

This is all I wish done ...

Now basic-save-buffer goes and "restores" the file modes to -rw-r--r--
so when I decide I'd like to "get -e" the file, get complains that a
writeable file exists.

Why does basic-save-buffer work this way? Shouldn't a non-nil return
from a write-file-hook mean do nothing further with the file?

If not, how do I get round this? There's nowhere to hook in & set the
file modes back .... is there?

Murmf...

--
Paul Hudson	 MAIL: Monotype ADG, Science Park, Cambridge, CB4 4FQ, UK.
		PHONE: +44 (223) 420018	  EMAIL: paul@moncam.co.uk,
	;"	  FAX: +44 (223) 420911		 ...!ukc!acorn!moncam!paul
 `"";";"        These opinions void where prohibited by law.