[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 59e7efe: Extract grep-find-ignored-directories proc
From: |
Sam Steingold |
Subject: |
[Emacs-diffs] master 59e7efe: Extract grep-find-ignored-directories processing from rgrep-default-command |
Date: |
Fri, 10 Feb 2017 14:53:17 -0500 (EST) |
branch: master
commit 59e7efe7bdfb384017d34265df3e6c15837b972e
Author: Sam Steingold <address@hidden>
Commit: Sam Steingold <address@hidden>
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 22d4f2a..b3d8a51 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 "))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 59e7efe: Extract grep-find-ignored-directories processing from rgrep-default-command,
Sam Steingold <=