[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 644cdd1: Use grep's --null option (Bug#6843)
From: |
Dmitry Gutov |
Subject: |
Re: [Emacs-diffs] master 644cdd1: Use grep's --null option (Bug#6843) |
Date: |
Wed, 26 Jul 2017 19:58:32 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Thunderbird/55.0 |
Hey Noam,
Sorry I'm late to the party. Some questions below. Thanks.
On 7/20/17 3:02 AM, Noam Postavsky wrote:
branch: master
commit 644cdd1aa0a10dbfffa3b9b4c7a97f8cddded0b8
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
...
+*** Grep commands will now use GNU grep's '--null' option if
+available, which allows distinguishing the filename from contents if
+they contain colons. This can be controlled by the new custom option
+'grep-use-null-filename-separator'.
Why do the want the option?
And on the same note, are there any versions of Grep in widespread usage
that don't support '--null'? AFAICT this flag was added to GNU Grep 2.4
which was released in 1999.
+(defconst grep--regexp-alist-bin-matcher
+ '("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
+(defconst grep-with-null-regexp-alist
+ `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\):" 1 3 ,grep--regexp-alist-column nil
nil
Any reason to change 2 to 3? Why don't we use a non-capturing group for
\0 here?
If the numbers are the same, we could keep the variable's name the same
as well. As a result, most third-party code would continue to simply work.
+ (2 '(face unspecified display ":")))
+ ,grep--regexp-alist-bin-matcher)
+ "Regexp used to match grep hits.
+See `compilation-error-regexp-alist'.")
+(defconst grep-fallback-regexp-alist
Compensating for the multitude of variables by eliminating newlines
between them doesn't look too hot to me.