Karl Fogel <address@hidden> writes:
(let ((dir (file-name-directory buffer-file-name)))
(if (and file-precious-flag
(file-writable-p dir))
;; If file is precious, write temp name, then rename it.
;; This requires write access to the containing dir,
;; which is why we don't try it if we don't have that access.
(let ((realname buffer-file-name)
tempname succeed
(umask (default-file-modes))
(old-modtime (visited-file-modtime)))
[...continue on to write directly to the file...]
The documentation for `file-precious-flag' doesn't say anything about
it only applying if the containing directory is writeable. But that
seems to be how we treat it, in the conditional above.
Is this just a bug?
If the directory is not writable, there is no way to obey
file-precious-flag. That means that the only alternative is to signal
an error. Off the top of my head, I think it's better to fall back on
the usual file saving method instead, because that's almost always what
the user would want.