From 59e7efe7bdfb384017d34265df3e6c15837b972e Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Fri, 10 Feb 2017 14:53:02 -0500 Subject: [PATCH] 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'. --- lisp/progmodes/grep.el | 26 ++++++++++++-------------- 1 file 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 ")) -- 2.39.5