]> git.eshelyaron.com Git - emacs.git/commitdiff
(grep-compute-defaults): Use executable-command-find-posix-p.
authorRichard M. Stallman <rms@gnu.org>
Thu, 29 Jan 2004 17:54:36 +0000 (17:54 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 29 Jan 2004 17:54:36 +0000 (17:54 +0000)
(grep-find): Check `grep-find-command'.

lisp/progmodes/grep.el

index cb8fcf6e0422524673eec25f82e18a18c0d208f1..279d7211cdd3ec69cee3bfeaf7ca90154ac4d8b3 100644 (file)
@@ -318,7 +318,12 @@ Sets `grep-last-buffer' and runs `grep-setup-hook'."
              'gnu)))
   (unless grep-find-command
     (setq grep-find-command
-         (cond ((eq grep-find-use-xargs 'gnu)
+          (cond ((not (executable-command-find-unix-p "find"))
+                (message
+                 (concat "compile.el: Unix type find(1) not found. "
+                         "Please set `grep-find-command'."))
+                nil)
+               ((eq grep-find-use-xargs 'gnu)
                 (format "%s . -type f -print0 | xargs -0 -e %s"
                         find-program grep-command))
                (grep-find-use-xargs
@@ -443,11 +448,17 @@ easily repeat a find command."
    (progn
      (unless grep-find-command
        (grep-compute-defaults))
-     (list (read-from-minibuffer "Run find (like this): "
-                                grep-find-command nil nil
-                                'grep-find-history))))
-  (let ((null-device nil))             ; see grep
-    (grep command-args)))
+     (if grep-find-command
+        (list (read-from-minibuffer "Run find (like this): "
+                                    grep-find-command nil nil
+                                     'grep-find-history))
+       ;; No default was set
+       (read-string
+        "compile.el: No `grep-find-command' command available. Press RET.")
+       (list nil))))
+  (when (and grep-find-command command-args)
+    (let ((null-device nil))           ; see grep
+      (grep command-args))))
 
 (defun grep-expand-command-macros (command &optional regexp files dir excl case-fold)
   "Patch grep COMMAND replacing <D>, etc."