summaryrefslogtreecommitdiff
path: root/lisp/find-cmd.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-09-24 15:23:13 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-09-24 15:23:13 -0400
commit0e176389a723f7eec072af62cde12314de7f70e2 (patch)
treee05fb47591ee7a38362f4a505d1e04789d50b837 /lisp/find-cmd.el
parentcd812613c83e2d22a697a9312f9406a99bd8ae7d (diff)
downloademacs-0e176389a723f7eec072af62cde12314de7f70e2.tar.gz
* lisp/find-cmd.el (find-cmd): Use grep's `find-program'.
Suggested by <lompik@voila.fr>. Fixes: debbugs:18518
Diffstat (limited to 'lisp/find-cmd.el')
-rw-r--r--lisp/find-cmd.el26
1 files changed, 15 insertions, 11 deletions
diff --git a/lisp/find-cmd.el b/lisp/find-cmd.el
index acd820a31ce..276aeed1208 100644
--- a/lisp/find-cmd.el
+++ b/lisp/find-cmd.el
@@ -39,6 +39,8 @@
;;; Code:
+(require 'grep)
+
(defconst find-constituents
'((and . find-and)
(not . find-not)
@@ -145,13 +147,15 @@ For example:
`default-directory' is used as the initial search path. The
result is a string that should be ready for the command line."
- (concat
- "find " (shell-quote-argument (expand-file-name default-directory)) " "
- (cond
- ((cdr subfinds)
- (mapconcat 'find-to-string subfinds ""))
- (t
- (find-to-string (car subfinds))))))
+ ;; FIXME: Provide a version that returns a list of strings (ready to pass to
+ ;; call-process).
+ (concat find-program " "
+ (shell-quote-argument (expand-file-name default-directory)) " "
+ (cond
+ ((cdr subfinds)
+ (mapconcat #'find-to-string subfinds ""))
+ (t
+ (find-to-string (car subfinds))))))
(defun find-and (form)
"And FORMs together, so:
@@ -161,7 +165,7 @@ will produce:
(if (< (length form) 2)
(find-to-string (car form))
(concat "\\( "
- (mapconcat 'find-to-string form "-and ")
+ (mapconcat #'find-to-string form "-and ")
"\\) ")))
(defun find-or (form)
@@ -172,7 +176,7 @@ will produce:
(if (< (length form) 2)
(find-to-string (car form))
(concat "\\( "
- (mapconcat 'find-to-string form "-or ")
+ (mapconcat #'find-to-string form "-or ")
"\\) ")))
(defun find-not (form)
@@ -183,7 +187,7 @@ will produce:
If you wanted the FORMs -and(ed) together instead then this would
suffice:
\(not \(and \(mtime \"+1\"\) \(name \"something\"\)\)\)"
- (concat "-not " (find-or (mapcar 'find-to-string form))))
+ (concat "-not " (find-or (mapcar #'find-to-string form))))
(defun find-prune (form)
"-or together FORMs postfix '-prune' and then -or that with a
@@ -194,7 +198,7 @@ will produce (unwrapped):
-prune -or -true \\\) -and -name '*.pm' \\\)"
(find-or
(list
- (concat (find-or (mapcar 'find-to-string form)) (find-generic "prune"))
+ (concat (find-or (mapcar #'find-to-string form)) (find-generic "prune"))
(find-generic "true"))))
(defun find-generic (option &optional oper argcount args dont-quote)