emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file-precious-flag not taken seriously enough?


From: Kevin Rodgers
Subject: Re: file-precious-flag not taken seriously enough?
Date: Fri, 14 Nov 2008 07:43:44 -0700
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

Chong Yidong wrote:
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.

In case the usual file saving method results in a problem (which
file-precious-flag was set to prevent), shouldn't there be a warning
message here to inform the user?  Not to distract him/her, but so that
they can find a clue in the *Messages* buffer after something has gone
wrong.

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]