Subject: RE: bug#7617: 24.0.50; `expand-file-name': removal of slashes

From: "Drew Adams" <[email-masked]>
Date: Mon, 13 Dec 2010 07:47:49 -0800

> > And it's not clear what that would mean in terms of the 
> > expansion I'm after (which is exactly the expansion of
> > `expand*' minus the slash collapsing).
> 
> But after the expansion, wouldn't you remove everything up to and
> including the double slash?

No, not at all.  If I wanted to remove the prefix I would use
`substitute-in-file-name'.

> If so, why do you need the expansion, if
> most of it will be thrown away?  And if you don't remove the part up
> to the double slash, then why do you need to keep the double slash?

This is raw user input.  I want to keep the prefix, if any, as it is (modulo ~
and any other changes `expand*' makes except for slash collapsing).  I don't
ever remove the prefix.  Emacs (e.g. file-name reading) handles
(ignores/removes) the prefix when the user finally hits RET.

E.g., I want this behavior, with ~ = /home/toto":
(expand-file-name "foo" "~//usr/") -> "/home/toto//usr/foo"

Likewise, if double slashes appear in the first arg I want them preserved.  As I
said, "exactly the expansion of `expand*' minus the slash collapsing".

It's OK.  I can go with what I have now.  And I can keep looking or experiment
with other approaches such as temporarily removing the prefix (if any) and
sewing it back on.

I get the message that I haven't missed some obviously better solution.  And I
get the message that the `expand*' behavior will not be changed (including,
e.g., adding an optional arg that inhibits slash collapsing).

Thanks for adding mention of slash collapsing to the doc string.  I hope you
will also consider mentioning that a valid file name is expected and anything
else results in undefined behavior.  Feel free to close the bug now.