[Top][All Lists]

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

Re: convert-standard-filename (was: [Emacs-diffs] /srv/bzr/emacs/trunk r

From: Eli Zaretskii
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

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden, address@hidden
> 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

reply via email to

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