Subject: Re: bug#8653: 24.0.50; `M-x grep' output converts `~' to /cygdrive/c/...

From: Stefan Monnier <[email-masked]>
Date: Wed, 11 May 2011 21:54:32 -0300

> M-x grep foo ~/mydir/f*.el
> results in this kind of output in buffer *grep*:
 
> /cygdrive/c/mydir/foobar.el:203: blah blah foo blah
 
Let me add to Eli's answer [tho, as someone whose experience with
Windows only goes as far as "install firefox&putty to access non-Windows
machines"]: IIUC the expansion of ~ (to something like "C:/...") is
performed by the shell used to run grep, and the conversion to
"/cygdrive/c/..." is performed by the particular grep you use
(presumably cygwin's).

So to fix the problem at hand we need:
- add something like cygwin-mount.el to Emacs.
- change grep.el to use abbreviate-file-name.

Contrary to Eli, I'm not fundamentally opposed to including something
like cygwin-mount.el in Emacs.  As for changing grep.el, it could be
a valid option, tho it would either have to be a non-default setting, or
be done carefully to minimize the performance impact (M-x grep is
already slowish).

Of course, another take on it is to change the problem: maybe we could
make it easier to run an equivalent command with relative file names.
Not knowing how/why you ended up with "M-x grep foo ~/mydir/f*.el",
I don't know what could make it easier.

        Stefan