[Top][All Lists]

[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 21:33:11 +0200

> From: "Drew Adams" <address@hidden>
> Cc: <address@hidden>
> Date: Sat, 6 Feb 2010 07:33:17 -0800
> But .emacs and _emacs could be two different files on MS-DOC, no?

No.  MS-DOS does not allow file names with leading dots.  There cannot
be a file name like .emacs there.

Look, I think this discussion is getting out of hand.  Let me try to
step back a notch and try anew.

There's a problem with file names, such as ".emacs", defined in Emacs
Lisp code as literal strings: some filesystems don't allow such
names.  `convert-standard-filename' was introduced to take a Posix
file name and produce from it a file name that can be used instead on
the particular filesystem.  So instead of

  (defvar foo-file
          (if (eq system-type 'foo)
             (if (eq system-type 'bar)

we can now have just this:

  (defvar foo-file (convert-standard-filename "this"))

So far so good?

Same considerations apply when a file name is constructed from
fragments, like in

   (append ".emacs." (user-full-name) ".log")

In order to get a file name that any supported platform could use, you
need to run the result of this through `convert-standard-filename'.


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, like e.g. a literal `?' on a
Windows disk.  An arbitrary string generally needs such a treatment,
before it can safely be used as a file name.  That's why Emacs
defcustoms use it.

Any questions so far?

reply via email to

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