[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
convert-standard-filename (was: [Emacs-diffs] /srv/bzr/emacs/trunk r1052
From: |
Stefan Monnier |
Subject: |
convert-standard-filename (was: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files)) |
Date: |
Fri, 05 Aug 2011 13:18:40 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> 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?
>> and that the functionality require by the OP is not quite
>> the one provided by convert-standard-filename, AFAIK
> The addition of converting Cygwin file names to native w32 file names
> is an add-on functionality. Originally, convert-standard-filename was
> not supposed to handle these issues at all. The function was actually
> created for the DOS port, at RMS's advice (when he saw that I was
> committing changes to defcustom's that used a different file name
> conditioned by system-type). The rest is history...
Yes, the behavior is a mess, really.
>> My understanding is:
>> - convert-standard-filename is to convert a predefined name, which may
>> be mentioned in docs, using mostly Unix conventions so that it works
>> on whichever OS we're using. E.g. it may do things like map ".emacs"
>> to "_emacs".
> Correct.
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".
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.
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.
Stefan
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Stefan Monnier, 2011/08/01
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Sam Steingold, 2011/08/02
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Eli Zaretskii, 2011/08/02
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Stefan Monnier, 2011/08/02
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Eli Zaretskii, 2011/08/02
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Stefan Monnier, 2011/08/02
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files), Eli Zaretskii, 2011/08/03
- convert-standard-filename (was: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files)),
Stefan Monnier <=
- Re: convert-standard-filename (was: [Emacs-diffs] /srv/bzr/emacs/trunk r105295: * lisp/progmodes/etags.el (etags-file-of-tag, etags-tags-table-files)), Eli Zaretskii, 2011/08/06
- Re: convert-standard-filename, Stefan Monnier, 2011/08/07
- Re: convert-standard-filename, Lennart Borgman, 2011/08/07
- Re: convert-standard-filename, Stefan Monnier, 2011/08/07
- Re: convert-standard-filename, Lennart Borgman, 2011/08/07
- Re: convert-standard-filename, Eli Zaretskii, 2011/08/07
- Re: convert-standard-filename, Lennart Borgman, 2011/08/07
- Re: convert-standard-filename, Eli Zaretskii, 2011/08/08
- Re: convert-standard-filename, Lennart Borgman, 2011/08/08
- Re: convert-standard-filename, Eli Zaretskii, 2011/08/08