summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-09-29 18:23:23 +0000
committerRichard M. Stallman <rms@gnu.org>2002-09-29 18:23:23 +0000
commit2c74359fda6a3593ef31f85877ee9331d4174e66 (patch)
tree91b5fc049b8cc6129ee7ce46d366ce2fef6574ef
parent95062c84d7c7f7f16902b3260a7c17c4cd9eff03 (diff)
downloademacs-2c74359fda6a3593ef31f85877ee9331d4174e66.tar.gz
(grep-compute-defaults): Move definition up before `grep-command'.
-rw-r--r--lisp/progmodes/compile.el64
1 files changed, 32 insertions, 32 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 0458c665c51..c26044dd9ed 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -66,6 +66,38 @@ will be parsed and highlighted as soon as you try to move to them."
(integer :tag "First N lines"))
:group 'compilation)
+(defun grep-compute-defaults ()
+ (unless grep-command
+ (setq grep-command
+ (if (equal (condition-case nil ; in case "grep" isn't in exec-path
+ (call-process grep-program nil nil nil
+ "-e" "foo" null-device)
+ (error nil))
+ 1)
+ (format "%s -n -e " grep-program)
+ (format "%s -n " grep-program))))
+ (unless grep-find-use-xargs
+ (setq grep-find-use-xargs
+ (if (and
+ (equal (call-process "find" nil nil nil
+ null-device "-print0")
+ 0)
+ (equal (call-process "xargs" nil nil nil
+ "-0" "-e" "echo")
+ 0))
+ 'gnu)))
+ (unless grep-find-command
+ (setq grep-find-command
+ (cond ((eq grep-find-use-xargs 'gnu)
+ (format "%s . -type f -print0 | xargs -0 -e %s"
+ find-program grep-command))
+ (grep-find-use-xargs
+ (format "%s . -type f -print | xargs %s"
+ find-program grep-command))
+ (t (cons (format "%s . -type f -exec %s {} %s \\;"
+ find-program grep-command null-device)
+ (+ 22 (length grep-command))))))))
+
(defcustom grep-command nil
"The default grep command for \\[grep].
The default value of this variable is set up by `grep-compute-defaults';
@@ -579,38 +611,6 @@ to a function that generates a unique name."
(cons msg code)))
(cons msg code)))))
-(defun grep-compute-defaults ()
- (unless grep-command
- (setq grep-command
- (if (equal (condition-case nil ; in case "grep" isn't in exec-path
- (call-process grep-program nil nil nil
- "-e" "foo" null-device)
- (error nil))
- 1)
- (format "%s -n -e " grep-program)
- (format "%s -n " grep-program))))
- (unless grep-find-use-xargs
- (setq grep-find-use-xargs
- (if (and
- (equal (call-process "find" nil nil nil
- null-device "-print0")
- 0)
- (equal (call-process "xargs" nil nil nil
- "-0" "-e" "echo")
- 0))
- 'gnu)))
- (unless grep-find-command
- (setq grep-find-command
- (cond ((eq grep-find-use-xargs 'gnu)
- (format "%s . -type f -print0 | xargs -0 -e %s"
- find-program grep-command))
- (grep-find-use-xargs
- (format "%s . -type f -print | xargs %s"
- find-program grep-command))
- (t (cons (format "%s . -type f -exec %s {} %s \\;"
- find-program grep-command null-device)
- (+ 22 (length grep-command))))))))
-
;;;###autoload
(defun grep (command-args)
"Run grep, with user-specified args, and collect output in a buffer.