From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: file-truename, convert-standard-filename Date: Sat, 06 Feb 2010 23:58:13 +0200 Message-ID: <83zl3mdo22.fsf@gnu.org> References: <83k4urfqs9.fsf@gnu.org> <0B5BFE3DC87648888328B75164292F06@us.oracle.com> <83bpg2g2l8.fsf@gnu.org> <834oluf9c8.fsf@gnu.org> <07544B532C8E490F96FE0B1CF403C510@us.oracle.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1265493582 19247 80.91.229.12 (6 Feb 2010 21:59:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Feb 2010 21:59:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 06 22:59:40 2010 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.69) (envelope-from ) id 1Ndsgk-0005Oz-GC for ged-emacs-devel@m.gmane.org; Sat, 06 Feb 2010 22:59:38 +0100 Original-Received: from localhost ([127.0.0.1]:49270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ndsgj-0004gX-0C for ged-emacs-devel@m.gmane.org; Sat, 06 Feb 2010 16:59:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ndsgd-0004gP-Uh for emacs-devel@gnu.org; Sat, 06 Feb 2010 16:59:31 -0500 Original-Received: from [199.232.76.173] (port=46294 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ndsgd-0004gH-LN for emacs-devel@gnu.org; Sat, 06 Feb 2010 16:59:31 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Ndsgb-0002FQ-Tm for emacs-devel@gnu.org; Sat, 06 Feb 2010 16:59:31 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:46538) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ndsgb-0002Eu-Ef for emacs-devel@gnu.org; Sat, 06 Feb 2010 16:59:29 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0KXF00000WQVIK00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 06 Feb 2010 23:58:12 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.70.67.249]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KXF00L68X0YZF40@a-mtaout22.012.net.il>; Sat, 06 Feb 2010 23:58:11 +0200 (IST) In-reply-to: <07544B532C8E490F96FE0B1CF403C510@us.oracle.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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:120996 Archived-At: > From: "Drew Adams" > Cc: > Date: Sat, 6 Feb 2010 12:46:02 -0800 > > That means that in order to use ANY file name (any file-name string, no matter > where it was coded or how it is produced), you need to apply c-s-f to it, if you > don't know whether the name is supported by all platforms that might be used by > your code. Again, the case when the string is known to be a name of an existing file is the important exception. For example, if it comes from buffer-file-name, or from default-directory, or from other similar interfaces. > > If this part is understood, then just use `convert-standard-filename' > > in any situation where a string to be used as a file name might not be > > valid on the underlying filesystem, > > Which for an unknown string (e.g. the string value of a variable) means ALL > situations, no? It could be, unless, again, you know that a file by that name already exists. > BTW, I notice that prior to Emacs 23 the Emacs source code did not use c-s-f > very much (e.g. defcustoms, such as in recentf.el); Emacs 23 uses it much more. > I suppose this means that we had more problems with this before Emacs 23. No, it just means we made some cleanup. The situations where this really matters are very rare, and if you ignore the MS-DOS case, are almost non-existent. People rarely use characters in file names that get you in trouble on MS-Windows. And if the file name comes from the user, you can almost be certain she will never use such characters, and even if she does, she deserves the error message. About the only real use-case is when the file name comes from the Lisp code itself. Which is why I mentioned literal strings so many times. > But it does not seem like even the Emacs 23 source code calls c-s-f for all of > the situations that I think you're describing. It does where we are certain it matters. See files.el for a few examples. > Maybe adding c-s-f everywhere is an ongoing thing, and the code just hasn't yet > caught up with the rule? Something like that. But again, many places will never need it.