emacs-devel
[Top][All Lists]
Advanced

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

Re: file-truename, convert-standard-filename


From: Eli Zaretskii
Subject: Re: file-truename, convert-standard-filename
Date: Sat, 06 Feb 2010 11:01:23 +0200

> From: "Drew Adams" <address@hidden>
> Cc: <address@hidden>
> Date: Fri, 5 Feb 2010 15:51:01 -0800
> 
> Thanks. Could you perhaps consider adding some of that information to the 
> doc? I
> don't see any of it there.

If I have time.  Although I'm not sure where: we don't have a place in
the manual that describes how to compare file names reliably.  Perhaps
we should.

> And judging from this thread, it appears that the purpose of
> `convert-standard-filename' is not too clear to everyone. It's still not clear
> to me, at least. 

Even after reading the ELisp node where it is documented?  Could you
tell what else is missing?

> What do you mean by "embedded literal string" in the source code? If the Emacs
> source code has (defcustom foo ".emacs"...), do I need to apply c-s-f to foo 
> in
> order to compare its value?

Only if the other string is a name of a file that already exists in
the filesystem.

> And does "Emacs sources" apply only to code distributed with Emacs
> or to any Emacs-Lisp source code?

The latter, of course.

> And you seem to say two things: a "file name embedded as a literal string" and
> "a name of a file mentioned in Emacs sources". Is c-s-f needed for certain 
> file
> names (e.g. those "mentioned" in Emacs sources) or for certain strings (e.g.
> literal strings in distributed source code) that name files?

``Literal string'' is the main issue here.  That's why this function
was introduced in the first place: to seamlessly take care of all the
places in Emacs Lisp sources where there's a literal string serving as
a file name, and that string might be an invalid file name on some
filesystems.

> IOW, is it about the name or the actual string object?

It's about the names that are valid on some systems, but not on
others.

> Does it matter whether it's (string= (file-truename ".emacs") (file-truename
> bar)) or (string= (file-truename foo) (file-truename bar)), where foo's value 
> is
> ".emacs"? Is c-s-f needed in the former case but not the latter?

It is needed in the first case, if `bar' is the name of a file already
existing in the filesystem, because on MS-DOS, `bar' could be "_emacs"
instead.  It _may_ be needed in the second case if one of `foo' or
`bar' is a string whose value is ".emacs", while the other is the name
of a file already existing in the filesystem.  It is _not_ needed if
both `foo' and `bar' hold names of files already existing on
filesystems of the same type.

> Obviously, I'm not yet understanding what this is about. Does it have 
> something
> to do with strings that are defined before Emacs gets dumped?

No, Emacs dumping is not the issue here, at least not directly.  For
defcustoms, it's not an issue because a defcustom is evaluated again
when a dumped Emacs starts.  So if the filesystem where it was dumped
is different from the one where it starts, the name will be
recomputed anew.




reply via email to

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