]> git.eshelyaron.com Git - emacs.git/commitdiff
(rgrep): Allow grep-find-ignored-directories
authorSam Steingold <sds@gnu.org>
Wed, 8 Jul 2009 14:23:57 +0000 (14:23 +0000)
committerSam Steingold <sds@gnu.org>
Wed, 8 Jul 2009 14:23:57 +0000 (14:23 +0000)
to be a cons cell (test . ignored-directory) to selectively ignore
some directories depending on the location of the search.

lisp/ChangeLog
lisp/progmodes/grep.el

index b7168fffd3ac8a00414f2c0cbb8a058218aaaa21..80e6d190553b2d740a1243e7162e06d29e9e253a 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-08  Sam Steingold  <sds@gnu.org>
+
+       * progmodes/grep.el (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.
+
 2009-07-08  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
index 2c70c61c32a2653b910e1fd4ba01a74d958b8d8f..241a5325a1c688b9ab04dc270390add87ea4c40a 100644 (file)
@@ -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 ")))))