Subject: Re: bug#32051: 26.1; grep-regexp-alist on windows

From: Noam Postavsky <[email-masked]>
Date: Wed, 4 Jul 2018 15:57:53 -0400

On 4 July 2018 at 12:26, Eli Zaretskii <[email-masked]> wrote:

> I don't think I can reproduce this.  I've just ran a Grep command
> whose hits look like this:
>
>   d:/gnu/emacs/branch/src/callproc.c:214:#ifdef DOS_NT
>
> and they seem to exhibit all the traits of a Grep hit.

Looking at the grep-regexp-alist, it is the case that a filename with
a colon will not be matched when grep doesn't support --null. In the
case where grep does support --null, the NUL byte is displayed like a
colon, so the difference might not leap out at you.

I think the patch below would fix it:

--- i/lisp/progmodes/grep.el
+++ w/lisp/progmodes/grep.el
@@ -381,3 +381,5 @@ grep-regexp-alist
               ;; [0-9]+ so as to accept ":034:" in file names.
-              "\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:"
+              "\\(?1:"
+              "\\(?:[a-zA-Z]:\\)?" ; Allow "C:..." for w32.
+              "[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:"
               "\\)")