diff options
author | Sam Steingold <sds@gnu.org> | 2009-07-08 14:23:57 +0000 |
---|---|---|
committer | Sam Steingold <sds@gnu.org> | 2009-07-08 14:23:57 +0000 |
commit | 49405d0e1be811957433cb0c89a2fbe099fcf5b9 (patch) | |
tree | 3d06b0e8d46a4a4e3601bfe27c6081cd6f596ef7 /lisp/progmodes/grep.el | |
parent | c1d5ce9488bba9b3bc2b1dffe5e3615a409c4854 (diff) | |
download | emacs-49405d0e1be811957433cb0c89a2fbe099fcf5b9.tar.gz |
(rgrep): Allow grep-find-ignored-directories
to be a cons cell (test . ignored-directory) to selectively ignore
some directories depending on the location of the search.
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r-- | lisp/progmodes/grep.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2c70c61c32a..241a5325a1c 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -194,7 +194,9 @@ Customize or call the function `grep-apply-setting'." (defcustom grep-find-ignored-directories vc-directory-exclusion-list - "*List of names of sub-directories which `rgrep' shall not recurse into." + "*List of names of sub-directories which `rgrep' shall not recurse into. +If an element is a cons cell, the car is called on the search directory +to determine whether cdr should not be recursed into." :type '(repeat string) :group 'grep) @@ -891,11 +893,18 @@ This command shares argument histories with \\[lgrep] and \\[grep-find]." (concat (shell-quote-argument "(") ;; we should use shell-quote-argument here " -path " - (mapconcat #'(lambda (dir) - (shell-quote-argument - (concat "*/" dir))) - grep-find-ignored-directories - " -o -path ") + (mapconcat + #'(lambda (ignore) + (cond ((stringp ignore) + (shell-quote-argument + (concat "*/" ignore))) + ((consp ignore) + (and (funcall (car ignore) dir) + (shell-quote-argument + (concat "*/" + (cdr ignore))))))) + grep-find-ignored-directories + " -o -path ") " " (shell-quote-argument ")") " -prune -o "))))) |