emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/consult 7c5a98a6ab 3/3: consult-grep: Respect grep-find


From: ELPA Syncer
Subject: [elpa] externals/consult 7c5a98a6ab 3/3: consult-grep: Respect grep-find-ignored-files and grep-find-ignored-directories (Fix #616)
Date: Sat, 23 Jul 2022 08:57:23 -0400 (EDT)

branch: externals/consult
commit 7c5a98a6abe5a42a9005d8c83a7ebef849e33e63
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult-grep: Respect grep-find-ignored-files and 
grep-find-ignored-directories (Fix #616)
---
 CHANGELOG.org |  1 +
 consult.el    | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index b1c3103e30..ca690ce257 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -8,6 +8,7 @@
 - Allow =consult-flymake= to work across all buffers in a project
 - Remove deprecated =consult-completing-read-multiple=
 - =consult-grep/git-grep/ripgrep=: Add =--fixed-strings= support
+- =consult-grep=: Respect =grep-find-ignored-directories/files=
 
 * Version 0.18 (2022-05-25)
 
diff --git a/consult.el b/consult.el
index dd534cb7cb..65a70529ca 100644
--- a/consult.el
+++ b/consult.el
@@ -236,8 +236,7 @@ See `consult--multi' for a description of the source data 
structure."
   "Regexp used to match file and line of grep output.")
 
 (defcustom consult-grep-args
-  "grep --null --line-buffered --color=never --ignore-case\
-   --exclude-dir=.git --line-number -I -r ."
+  "grep --null --line-buffered --color=never --ignore-case --line-number -I -r 
."
   "Command line arguments for grep, see `consult-grep'.
 The dynamically computed arguments are appended."
   :type 'string)
@@ -4392,7 +4391,12 @@ INITIAL is inital input."
 
 (defun consult--grep-builder (input)
   "Build command line given INPUT."
-  (pcase-let* ((cmd (split-string-and-unquote consult-grep-args))
+  (unless (boundp 'grep-find-ignored-files) (require 'grep))
+  (pcase-let* ((cmd (append (split-string-and-unquote consult-grep-args)
+                            (mapcar (lambda (s) (concat "--exclude=" s))
+                                    (bound-and-true-p grep-find-ignored-files))
+                            (mapcar (lambda (s) (concat "--exclude-dir=" s))
+                                    (bound-and-true-p 
grep-find-ignored-directories))))
                (`(,arg . ,opts) (consult--command-split input))
                (flags (append cmd opts))
                (ignore-case (or (member "-i" flags) (member "--ignore-case" 
flags))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]