From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: file-precious-flag not taken seriously enough? Date: Thu, 13 Nov 2008 10:26:23 -0500 Message-ID: <87r65f4pgg.fsf@cyd.mit.edu> References: <87bpwkgmzp.fsf@red-bean.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1226590011 12818 80.91.229.12 (13 Nov 2008 15:26:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Nov 2008 15:26:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Karl Fogel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 13 16:27:52 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L0e6Z-0006fZ-Di for ged-emacs-devel@m.gmane.org; Thu, 13 Nov 2008 16:27:35 +0100 Original-Received: from localhost ([127.0.0.1]:51788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0e5Q-0007T0-Rx for ged-emacs-devel@m.gmane.org; Thu, 13 Nov 2008 10:26:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0e5E-0007Pp-7f for emacs-devel@gnu.org; Thu, 13 Nov 2008 10:26:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0e5C-0007Nc-HI for emacs-devel@gnu.org; Thu, 13 Nov 2008 10:26:11 -0500 Original-Received: from [199.232.76.173] (port=36564 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0e5C-0007NP-BG for emacs-devel@gnu.org; Thu, 13 Nov 2008 10:26:10 -0500 Original-Received: from cyd.mit.edu ([18.115.2.24]:54501) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0e5C-00067z-HE for emacs-devel@gnu.org; Thu, 13 Nov 2008 10:26:10 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id D7DD357E09E; Thu, 13 Nov 2008 10:26:23 -0500 (EST) In-Reply-To: <87bpwkgmzp.fsf@red-bean.com> (Karl Fogel's message of "Thu, 13 Nov 2008 01:26:34 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:105637 Archived-At: Karl Fogel 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.