From 60acf5de6dacb5ea3430a1115ba8c1151a07d526 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 26 Jul 2017 19:21:55 -0400 Subject: [PATCH v1] Use '--null' for 'git grep' too (Bug#27840) * lisp/vc/vc-git.el (vc-git-grep): Pass '--null'. * lisp/progmodes/grep.el (grep--regexp-alist-bin-matcher): Handle the slightly different output from 'git grep's --null option. --- lisp/progmodes/grep.el | 5 +++-- lisp/vc/vc-git.el | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2ddaf884bc..4723290fbe 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -387,8 +387,9 @@ (defconst grep--regexp-alist-column (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 - (2 '(face unspecified display ":"))) + `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\)\\([\0:]\\)" 1 3 ,grep--regexp-alist-column nil nil + (2 '(face unspecified display ":")) + (4 '(face unspecified display ":"))) ,grep--regexp-alist-bin-matcher) "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index cc3e295641..1cdcfb3a5c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1433,8 +1433,8 @@ (defun vc-git-grep (regexp &optional files dir) (setq command nil)) (setq dir (file-name-as-directory (expand-file-name dir))) (setq command - (grep-expand-template "git --no-pager grep -n -e -- " - regexp files)) + (grep-expand-template + "git --no-pager grep -n --null -e -- " regexp files)) (when command (if (equal current-prefix-arg '(4)) (setq command -- 2.11.1