]> git.eshelyaron.com Git - emacs.git/commitdiff
Add variable vc-git-grep-template
authorFederico Tedin <federicotedin@gmail.com>
Sat, 1 Sep 2018 21:46:16 +0000 (18:46 -0300)
committerNoam Postavsky <npostavs@gmail.com>
Tue, 4 Sep 2018 22:53:59 +0000 (18:53 -0400)
* lisp/vc/vc-git.el (vc-git-grep-template): New variable, allows
changing the default arguments passed to git-grep when using
'vc-git-grep'.
* etc/NEWS: Mention 'vc-git-grep-template'.  (Bug#32549)

etc/NEWS
lisp/vc/vc-git.el

index f66bcb113834fc6676a6ba228dfed253fd65eb22..61b6d4e0e2b65e91ffbf8dc86ebf496bad9111cc 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -277,6 +277,10 @@ still be used if it exists.)  Set the variable to nil to get the
 previous behavior of always creating a buffer that visits a ChangeLog
 file.
 
+*** New customizable variable 'vc-git-grep-template'.
+This new variable allows customizing the default arguments passed to
+git-grep when 'vc-git-grep' is used.
+
 ** diff-mode
 *** Hunks are now automatically refined by default.
 To disable it, set the new defcustom 'diff-font-lock-refine' to nil.
index 96c2f38af427379f6a64cb28a7f242ddfc880484..69d629570263d18892daae6fbb8a0226484e403b 100644 (file)
@@ -179,6 +179,14 @@ Should be consistent with the Git config value i18n.logOutputEncoding."
   :type '(coding-system :tag "Coding system to decode Git log output")
   :version "25.1")
 
+(defcustom vc-git-grep-template "git --no-pager grep -n -e <R> -- <F>"
+  "The default command to run for \\[vc-git-grep].
+The following place holders should be present in the string:
+ <F> - file names and wildcards to search.
+ <R> - the regular expression searched for."
+  :type 'string
+  :version "27.1")
+
 ;; History of Git commands.
 (defvar vc-git-history nil)
 
@@ -1449,7 +1457,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
              (setq command nil))
        (setq dir (file-name-as-directory (expand-file-name dir)))
        (setq command
-             (grep-expand-template "git --no-pager grep -n -e <R> -- <F>"
+              (grep-expand-template vc-git-grep-template
                                     regexp files))
        (when command
          (if (equal current-prefix-arg '(4))