emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compile.el::grep-program - should it use egrep instead of grep?


From: Jari Aalto
Subject: Re: compile.el::grep-program - should it use egrep instead of grep?
Date: Thu, 08 Sep 2005 08:54:32 +0300

|     There is
| 
|        (defvar grep-program "egrep" ...)
| 
|     in compile.el,
| 
| No there isn't.  The default value of grep-program is "grep" or "zgrep".
| What version are you looking at?

21.3 + 21.4[1] use plain grep [2] in compile.el. The zgrep has
been commented out.

 
|      but in some systems the grep is the old one, which does
|     not provide the extended syntax. Would it be possible to set this by
|     default to 'egrep'?
| 
| Sorry, no.  Emacs's regexp syntax is based on the grep syntax rather
| than the egrep syntax.

I was referring to the calls of the external processes:

    M-x grep RET
    Run grep (like this): grep -n -e .....
    
or 

    M-x find-grep-dired RET
    ...
   find . \( -type f -exec grep -q "*xyz" {} \;  \) -exec ls -ld {} \;
                           
or 

    M-x grep-find
    Run find (like this): find . -type f -print0 | xargs -0 -e grep -n -e 

The use of grep(1) command in all of there is not optimal. So my question
was wheather there were any *nix OS that did not define egrep(1) and thus
would prevent using "egrep" as a default value. The problem with standard
grep(1) is that is does not allow extended syntax:

    .... grep -n '(this|that)'

E.g in SunOS. The standard "grep" isn't very useful default
for serious searching.

Jari

------------------------------
[1]
(emacs-version)
"GNU Emacs 21.4.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2005-03-17 on trouble, modified by Debian"

[1]
(defvar grep-program
  ;; Currently zgrep has trouble.  It runs egrep instead of grep,
  ;; and it doesn't pass along long options right.
  "grep"
  ;; (if (equal (condition-case nil     ; in case "zgrep" isn't in exec-path
  ;;             (call-process "zgrep" nil nil nil
  ;;                           "foo" null-device)
  ;;           (error nil))
  ;;         1)
  ;;     "zgrep"
  ;;   "grep")
  "The default grep program for `grep-command' and `grep-find-command'.
This variable's value takes effect when `grep-compute-defaults' is called.")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]