diff options
author | Sam Steingold <sds@gnu.org> | 2017-02-10 14:53:02 -0500 |
---|---|---|
committer | Sam Steingold <sds@gnu.org> | 2017-02-10 14:53:02 -0500 |
commit | 59e7efe7bdfb384017d34265df3e6c15837b972e (patch) | |
tree | 5eea2c7315c86d974b851265e13f6b1e4ba6715c /lisp/progmodes/grep.el | |
parent | abcba32c262e575b562ec0e481e55538536f969f (diff) | |
download | emacs-59e7efe7bdfb384017d34265df3e6c15837b972e.tar.gz emacs-59e7efe7bdfb384017d34265df3e6c15837b972e.tar.bz2 emacs-59e7efe7bdfb384017d34265df3e6c15837b972e.zip |
Extract grep-find-ignored-directories processing from rgrep-default-command
(rgrep-find-ignored-directories): Extract from `rgrep-default-command'.
Some Emacs packages use `grep-find-ignored-directories' to ignore some
directories, so will use this function instead of custom code.
(rgrep-default-command): Use `rgrep-find-ignored-directories'.
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r-- | lisp/progmodes/grep.el | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 22d4f2abd98..b3d8a51ceeb 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1045,6 +1045,15 @@ to specify a command to run." (if (eq next-error-last-buffer (current-buffer)) (setq default-directory dir))))))) +(defun rgrep-find-ignored-directories (dir) + "Return the list of ignored directories applicable to `dir'." + (delq nil (mapcar + (lambda (ignore) + (cond ((stringp ignore) ignore) + ((consp ignore) + (and (funcall (car ignore) dir) (cdr ignore))))) + grep-find-ignored-directories))) + (defun rgrep-default-command (regexp files dir) "Compute the command for \\[rgrep] to use by default." (require 'find-dired) ; for `find-name-arg' @@ -1066,20 +1075,9 @@ to specify a command to run." (shell-quote-argument "(") ;; we should use shell-quote-argument here " -path " - (mapconcat - 'identity - (delq nil (mapcar - #'(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 ") + (mapconcat (lambda (d) (shell-quote-argument (concat "*/" d))) + (rgrep-find-ignored-directories dir) + " -o -path ") " " (shell-quote-argument ")") " -prune -o ")) |