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: convert-standard-filename (was: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files)) Date: Sat, 06 Aug 2011 10:20:50 +0300 Message-ID: <83hb5vvwdp.fsf@gnu.org> References: <83vcufaaqf.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1312615381 32564 80.91.229.12 (6 Aug 2011 07:23:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 6 Aug 2011 07:23:01 +0000 (UTC) Cc: sds@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 06 09:22:56 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QpbDk-0007FR-Ii for ged-emacs-devel@m.gmane.org; Sat, 06 Aug 2011 09:22:56 +0200 Original-Received: from localhost ([::1]:54170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpbDj-0005d6-K4 for ged-emacs-devel@m.gmane.org; Sat, 06 Aug 2011 03:22:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpbDh-0005d0-4b for emacs-devel@gnu.org; Sat, 06 Aug 2011 03:22:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpbDf-0005Vh-QP for emacs-devel@gnu.org; Sat, 06 Aug 2011 03:22:53 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:32945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpbDf-0005Vd-Jm; Sat, 06 Aug 2011 03:22:51 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LPH00200V34P600@a-mtaout22.012.net.il>; Sat, 06 Aug 2011 10:22:50 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.94.185]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LPH002IXWI0T450@a-mtaout22.012.net.il>; Sat, 06 Aug 2011 10:22:49 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142923 Archived-At: > From: Stefan Monnier > Cc: sds@gnu.org, emacs-devel@gnu.org > Date: Fri, 05 Aug 2011 13:18:40 -0400 > > >> Still, the problem is that the intended meaning of > >> convert-standard-filename is unclear (what should it do on relative > >> file names?) > > For relative file names, it should produce a relative file name whose > > name is valid on the underlying filesystem. > > But how should it decide what is relative and what is not, e.g. in the > case of "c:/foo" (or worse "c:foo") mentioned in the docstring? Why by file-name-absolute-p, of course ;-) > But now I wonder what "it works on whichever OS we're running" means: > I was thinking of "Emacs can use this name on whichever OS we're > running", but the slash-to-backslash conversion seems to indicate it's > rather meant for "Emacs can pass this to external processes and they'll > understand it". The slash-to-backslash conversion is also a later addition. It was not needed originally, since DOS/Windows filesystems grok the forward slash just fine, and all the programs from the DJGPP toolset (the environment used to build and use Emacs on DOS) accept forward slashes as well as backslashes. > I think we really need to clarify what it's supposed to do. > And since a grep indicates that it's misused at many places, maybe the > best solution is to make it obsolete and replace it with a new (set of) > function(s) with clearer semantics. I agree this would be a good cleanup. > AFAICT, there are the following different needs: > - The original intention: convert a standard name such as "~/.emacs" so > it works everywhere. The argument should come from within Emacs. > This should pretty much only be used with a constant argument. > Maybe (a big maybe) it can be used for things like generating > a filename from some other piece of data, but I think even that should > be discouraged in favor of `md5'. > - Take a filename from outside Emacs and convert it into something Emacs > can use internally. Can do things like cygwin handling. Can assume > that the provided filename is valid, so it doesn't need to be careful > to drop invalid filename characters. Can convert backslashes into > slashes on Windows. > - Take an internal filename and convert it to something that can be used > outside of Emacs. E.g. convert slashes into backslashes. Again, this > can probably assume that the file name is already valid and doesn't > need to drop funny chars. Something like that. There's also dos-8+3-filename, which is needed when one compares with string= internal file names with those found on disk, but that's DOS-specific, or maybe it can be merged into the last category.