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

From: "Drew Adams" <[email-masked]>
Date: Thu, 12 May 2011 06:42:21 -0700

> > 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.

Everything you suggest (possibilities) sounds good to me.

Yes, if you use a relative path there is no such problem - e.g.,
M-x grep ../f*.el

I was in a directory far from the intended target.  I could have first done `M-x
cd', and that's a good workaround.  But I just gave the path to `grep' instead.
No biggee, but it would be good if the output were cleaner/simpler (assuming not
too great a cost).