[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file-precious-flag not taken seriously enough?
From: |
Chong Yidong |
Subject: |
Re: file-precious-flag not taken seriously enough? |
Date: |
Thu, 13 Nov 2008 10:26:23 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
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.