/[emacs]/emacs/lisp/progmodes/compile.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/compile.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.236.4.4 by eliz, Fri Apr 12 16:44:31 2002 UTC revision 1.236.4.5 by rms, Sun Sep 29 18:23:23 2002 UTC
# Line 66  will be parsed and highlighted as soon a Line 66  will be parsed and highlighted as soon a
66                   (integer :tag "First N lines"))                   (integer :tag "First N lines"))
67    :group 'compilation)    :group 'compilation)
68    
69    (defun grep-compute-defaults ()
70      (unless grep-command
71        (setq grep-command
72              (if (equal (condition-case nil ; in case "grep" isn't in exec-path
73                             (call-process grep-program nil nil nil
74                                           "-e" "foo" null-device)
75                           (error nil))
76                         1)
77                  (format "%s -n -e " grep-program)
78                (format "%s -n " grep-program))))
79      (unless grep-find-use-xargs
80        (setq grep-find-use-xargs
81              (if (and
82                   (equal (call-process "find" nil nil nil
83                                        null-device "-print0")
84                          0)
85                   (equal (call-process "xargs" nil nil nil
86                                        "-0" "-e" "echo")
87                         0))
88                  'gnu)))
89      (unless grep-find-command
90        (setq grep-find-command
91              (cond ((eq grep-find-use-xargs 'gnu)
92                     (format "%s . -type f -print0 | xargs -0 -e %s"
93                             find-program grep-command))
94                    (grep-find-use-xargs
95                     (format "%s . -type f -print | xargs %s"
96                             find-program grep-command))
97                    (t (cons (format "%s . -type f -exec %s {} %s \\;"
98                                     find-program grep-command null-device)
99                             (+ 22 (length grep-command))))))))
100    
101  (defcustom grep-command nil  (defcustom grep-command nil
102    "The default grep command for \\[grep].    "The default grep command for \\[grep].
103  The default value of this variable is set up by `grep-compute-defaults';  The default value of this variable is set up by `grep-compute-defaults';
# Line 579  to a function that generates a unique na Line 611  to a function that generates a unique na
611                      (cons msg code)))                      (cons msg code)))
612             (cons msg code)))))             (cons msg code)))))
613    
 (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))))))))  
   
614  ;;;###autoload  ;;;###autoload
615  (defun grep (command-args)  (defun grep (command-args)
616    "Run grep, with user-specified args, and collect output in a buffer.    "Run grep, with user-specified args, and collect output in a buffer.

Legend:
Removed from v.1.236.4.4  
changed lines
  Added in v.1.236.4.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26