unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* compile.el::grep-program - should it use egrep instead of grep?
@ 2005-09-07  7:05 Jari Aalto
  2005-09-08  2:41 ` Richard M. Stallman
  2005-09-08  5:54 ` Jari Aalto
  0 siblings, 2 replies; 10+ messages in thread
From: Jari Aalto @ 2005-09-07  7:05 UTC (permalink / raw)



There is

   (defvar grep-program "egrep" ...)

in compile.el, 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'? I'm not aware of any *nix OS that would not
include egrep.

Jari

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-07  7:05 compile.el::grep-program - should it use egrep instead of grep? Jari Aalto
@ 2005-09-08  2:41 ` Richard M. Stallman
  2005-09-08  5:54 ` Jari Aalto
  1 sibling, 0 replies; 10+ messages in thread
From: Richard M. Stallman @ 2005-09-08  2:41 UTC (permalink / raw)
  Cc: emacs-devel

    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?

     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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-07  7:05 compile.el::grep-program - should it use egrep instead of grep? Jari Aalto
  2005-09-08  2:41 ` Richard M. Stallman
@ 2005-09-08  5:54 ` Jari Aalto
  2005-09-08 17:55   ` Richard M. Stallman
  1 sibling, 1 reply; 10+ messages in thread
From: Jari Aalto @ 2005-09-08  5:54 UTC (permalink / raw)
  Cc: emacs-devel

|     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.")

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-08  5:54 ` Jari Aalto
@ 2005-09-08 17:55   ` Richard M. Stallman
  2005-09-12 14:31     ` Jari Aalto
  0 siblings, 1 reply; 10+ messages in thread
From: Richard M. Stallman @ 2005-09-08 17:55 UTC (permalink / raw)
  Cc: emacs-devel

    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.

I do not want to change to egrep as the default value for
grep-program.  Sorry.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-08 17:55   ` Richard M. Stallman
@ 2005-09-12 14:31     ` Jari Aalto
  2005-09-12 15:07       ` Andreas Schwab
  2005-09-13 15:54       ` Richard M. Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Jari Aalto @ 2005-09-12 14:31 UTC (permalink / raw)


"Richard M. Stallman" <rms@gnu.org> writes:

|     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.
| 
| I do not want to change to egrep as the default value for
| grep-program.  Sorry.

Could you elaborate a little. The syntax of grep is not sufficient to
make daily searches with M-x find-dired or M-x grep-find that happen
frequently during searching system log files or looking into program
and text document files.

Wouldn't that warrant to use egrep? This is what most people do with
daily searches when M-x grep is needed. egrep would be much more
sensible default at startup having no need to set up separate
customised changes for every person.

Jari

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-12 14:31     ` Jari Aalto
@ 2005-09-12 15:07       ` Andreas Schwab
  2005-09-12 15:58         ` Jari Aalto
  2005-09-13 15:54       ` Richard M. Stallman
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2005-09-12 15:07 UTC (permalink / raw)
  Cc: emacs-devel

Jari Aalto <jari.aalto@cante.net> writes:

> Could you elaborate a little. The syntax of grep is not sufficient to
> make daily searches with M-x find-dired or M-x grep-find that happen
> frequently during searching system log files or looking into program
> and text document files.

In GNU grep there is no expressive difference between BREs and EREs, only
the syntax differs.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-12 15:07       ` Andreas Schwab
@ 2005-09-12 15:58         ` Jari Aalto
  2005-09-12 16:30           ` Andreas Schwab
  2005-09-12 18:08           ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Jari Aalto @ 2005-09-12 15:58 UTC (permalink / raw)


Andreas Schwab <schwab@suse.de> writes:

| Jari Aalto <jari.aalto@cante.net> writes:
| 
| > Could you elaborate a little. The syntax of grep is not sufficient to
| > make daily searches with M-x find-dired or M-x grep-find that happen
| > frequently during searching system log files or looking into program
| > and text document files.
| 
| In GNU grep there is no expressive difference between BREs and EREs, only
| the syntax differs.

     $ grep --version
     grep (GNU grep) 2.5.1

     $ echo -e "this\nthat" |  grep '(this|that)'
     <nothing>

I assume you meant that the OS's grep binary package installs wrappers
around the grep(1) programs to call it with various arguments. However
all the systems do define egrep(1) which use ERE syntaxes, so the
appropriate call would always be even in GNU system:

     $ echo -e "this\nthat" | egrep '(this|that)'
     this 
     that

It's true that W32 can't use egrep shell script - But in the other
hand it's not GNU system. And, 99% of the Emacs who need *nix features
will install Cygwin, which can use the egrep(1) shell wrapper and
other utilities like cvs, svn, diff, etc.

Jari

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-12 15:58         ` Jari Aalto
@ 2005-09-12 16:30           ` Andreas Schwab
  2005-09-12 18:08           ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2005-09-12 16:30 UTC (permalink / raw)
  Cc: emacs-devel

Jari Aalto <jari.aalto@cante.net> writes:

> Andreas Schwab <schwab@suse.de> writes:
>
> | Jari Aalto <jari.aalto@cante.net> writes:
> | 
> | > Could you elaborate a little. The syntax of grep is not sufficient to
> | > make daily searches with M-x find-dired or M-x grep-find that happen
> | > frequently during searching system log files or looking into program
> | > and text document files.
> | 
> | In GNU grep there is no expressive difference between BREs and EREs, only
> | the syntax differs.
>
>      $ grep --version
>      grep (GNU grep) 2.5.1
>
>      $ echo -e "this\nthat" |  grep '(this|that)'
>      <nothing>

Which part of "only the syntax differs" did you not understand?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-12 15:58         ` Jari Aalto
  2005-09-12 16:30           ` Andreas Schwab
@ 2005-09-12 18:08           ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2005-09-12 18:08 UTC (permalink / raw)
  Cc: emacs-devel

>      $ echo -e "this\nthat" |  grep '(this|that)'

Try "grep '\(this\|that\)'"


        Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: compile.el::grep-program - should it use egrep instead of grep?
  2005-09-12 14:31     ` Jari Aalto
  2005-09-12 15:07       ` Andreas Schwab
@ 2005-09-13 15:54       ` Richard M. Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Richard M. Stallman @ 2005-09-13 15:54 UTC (permalink / raw)
  Cc: emacs-devel

    Could you elaborate a little. The syntax of grep is not sufficient to
    make daily searches with M-x find-dired or M-x grep-find that happen
    frequently during searching system log files or looking into program
    and text document files.

That is a rather specialized activity.  It is a minor side issue as
regards the choice of default.  grep syntax resembles Emacs regexp
syntax, and grep is the "normal case" anyway, so grep will remain the
default.

If you prefer egrep as the default, you can set it in your .emacs.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-09-13 15:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-07  7:05 compile.el::grep-program - should it use egrep instead of grep? Jari Aalto
2005-09-08  2:41 ` Richard M. Stallman
2005-09-08  5:54 ` Jari Aalto
2005-09-08 17:55   ` Richard M. Stallman
2005-09-12 14:31     ` Jari Aalto
2005-09-12 15:07       ` Andreas Schwab
2005-09-12 15:58         ` Jari Aalto
2005-09-12 16:30           ` Andreas Schwab
2005-09-12 18:08           ` Stefan Monnier
2005-09-13 15:54       ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).