[Top][All Lists]

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

Re: substitute-in-file-name is not distributive

From: Stefan Monnier
Subject: Re: substitute-in-file-name is not distributive
Date: Tue, 30 Oct 2012 23:41:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

>> What do you append it to?  If the mapping is arbitrary, you first need
>> to convert the Cywin name to Windows, the concat, then convert
>> back, right?
> Sure. In practice, concatenating short relative paths works pretty
> well, and I'd like to translate /foo/bar/qux\bar/spam.txt to
> /foo/bar/qux/bar/spam.txt.  That work can be done inside the
> s-i-f-n handler.

So for relative names you'd just convert \ to / ?

>>>> So Cygin itself treats "\\bin" and "/bin" as equivalent
>>> No --- Cygwin treats "\\bin" just as Windows would: it's
>>> a drive-letter-relative Windows path. "/bin" is a perfectly normal
>>> POSIX path.
>> Now I'm lost.  So you're saying that Cygwin accepts backslash delimited
>> file names and assumes they're Window file names?  IOW Cygwin already
>> accepts just as happily Windows file names?  In this case, I'm wondering
>> why you need s-i-f-n.
> Cygwin handles them, but Emacs doesn't.

Currently, that's true, and while under w32 we just treat \ and / as
equivalent, it sounds like this is not an option for Cygwin, right?

I mean that Emacs-w32 is happy to treat \ as a separator but it will not
itself add a \, so it often silently turns \ into /.  We could do the
same under Cygwin, but from you say it sounds like it might not do the
right thing.

Of course, that depends on details: is /usr\bin treated by Cygwin as
identical to /usr/bin?  What about \bin compared to /bin?

>> Is it because Cygwin needs backslashes to recognize Windows file names
>> whereas Emacs wants to turn all backslashes into slashes?
> I see Emacs treating backslashes as just another filename constituent.

Right, because the Cygwin build uses the "Unix" code which presumes
POSIX-like semantics.

> You're right: the problem isn't GUI-specific.  I just came across the
> problem while doing general improvements to Cygwin Emacs.  Maybe I'm
> the first one to be really bothered by the problem.  I do a lot of
> mixed Cygwin and Windows development work.

OK, makes sense.

>>>> If you limit yourself to:
>>>> - rewrite "\\`[a-zA-Z]:" to "/cygdrive/c" (regardless if it is followed
>>> Not all Cygwin installations use "cygdrive".
>> I kind of know.
> Sorry for being repetitive.

That's not what I meant: I meant that I have a vague knowledge that this
is the case, but I don't know what it really entails (e.g. can this
name be changed, or can it even not exist at all?).


reply via email to

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