On 10/10/12 10:18 AM, Eli Zaretskii wrote: >> Date: Wed, 10 Oct 2012 09:48:21 -0700 >> From: Daniel Colascione >> CC: emacs-devel@gnu.org >> >> Cygwin itself deals adequately with being given Windows paths --- >> it's Emacs that could handle them more elegantly. It's important to note that the Cygwin and Windows path trees can be completely disjoint. Cygwin has its own mount table. I have my system configured so that there's a close resemblance between the two hierarchies, but it doesn't have to be so. c:\foo could map to /qux/bar/spam/blah. > If Cygwin can handle these file names (which is what I thought was the > case), why not change expand-file-name so that the DOS_NT parts there > are also compiled in for Cygwin? > > Hmm... but then typing "C-x C-f /foo/bar TAB" will prepend a drive > letter, perhaps, which is not what you want. Right. I suppose I could change the code so that we understand both kinds of path but prefer POSIX ones, but the approach I have in mind feels more elegant. What happens with my s-i-f-n handler is that read-file-name accepts Windows paths and (when completion works) completes them, but as soon as the user accepts a path, it's converted to a Cygwin path and remains as a Cygwin path through the rest of Emacs. It's pretty elegant in practice. If we do nothing, Emacs treats Windows paths as opaque blobs. From Emacs' point of view, if you try to find-file c:\etc\passwd when default-directory is "/etc", you're asking Emacs to find the file "/etc/c:\\etc\\passwd". That's not right. There are three approaches to solving the problem: 1) Modify the DOS_NT code so that Cygwin Emacs can parse Windows paths. Pass all paths to Cygwin and let Cygwin sort them out. This approach will configure the hell out of other bits of code that assume that we have Windows paths IFF (memq system-time '(windowsnt dos)). It also complicates file-directory-name and friends. 2) Explicitly reject Windows paths and provide a way for the user to trigger path conversion. This approach strikes me as inconvenient. 3) Use a s-i-f-n hook to convert paths to Cygwin ones. This approach works well enough aside from the completion breakage. One way to deal with the completion problem would be to build completions based on the *Windows* path, not the Cygwin path, but it wasn't apparent to me how you could convince the code to do that. There's no file-name-handler-alist handler for "build me a set of completions, but before you call substitute-in-file-name."