From howard@silverstream.com  Thu May  8 12:09:51 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Thu" " 8" "May" "1997" "15:09:01" "-0400" "Howard Melman" "howard@silverstream.com" nil "40" "RE: M-x grep (recursive?)" "^From:" nil nil "5" nil nil nil nil]
	nil)
Received: from ptown.silverstream.com (silverstream.com [204.164.96.2]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with ESMTP id MAA00497 for <voelker@cs.washington.edu>; Thu, 8 May 1997 12:09:50 -0700
Received: from ABSOLUT.silverstream.com ([204.164.96.41])           by ptown.silverstream.com (Netscape Mail Server v2.02) with SMTP           id AAA210 for <voelker@cs.washington.edu>;           Thu, 8 May 1997 15:09:01 -0400
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
In-Reply-To: <199705080131.SAA42220@joker.cs.washington.edu>
References: <c=US%a=_%p=Lucas%l=SANCTUARY-970507175339Z-8267@coruscant.lucasarts.com> 	<199705080131.SAA42220@joker.cs.washington.edu>
X-Mailer: VM 6.30 under Emacs 19.34.1
Message-ID: <19970508190900203.AAA210@ABSOLUT.silverstream.com>
From: Howard Melman <howard@silverstream.com>
To: voelker@cs.washington.edu (Geoff Voelker)
Subject: RE: M-x grep (recursive?)
Date: Thu, 8 May 1997 15:09:01 -0400


On Wed May 7, 1997, Geoff Voelker wrote:

> I've added a discussion of grep and recursive grep to the FAQ at:
> 
> http://www.cs.washington.edu/homes/voelker/ntemacs.html#grep
> http://www.cs.washington.edu/homes/voelker/ntemacs.html#grep-recursive
> 
> I know that this has come up before with similar answers, but thanks
> Bret and Jeff for again answering the question.

I think it would be worthwhile to mention igrep in this
section.  It's a standard package that offers a nicer
interface to the grep family commands including a find
version.  

For ntemacs folks need to know:

  If you are running Windows 95/NT, you should install findutils
  and grep from release 17.1 (or higher) of the Cygnus GNU-Win32
  distribution.  See <URL:http://www.cygnus.com/misc/gnu-win32/>.

Also cmd.exe and the cygnus tools have some problems, this
works around them:

  ;; use bash for compile commands
  ;; cygnus find doesn't work great under cmd.exe, particularly
  ;; -name "*.java" doesn't work under cmd.exe but it does under bash
  (defadvice compile-internal (around cygnus-workaround activate)
    (let ((shell-file-name "d:\\gnu\\bin\\bash.exe")
          (win32-quote-process-args t)
          (shell-command-switch "-c")
          (path-separator ":")
          (grep-null-device "NUL"))
      ad-do-it))
  
  (setq igrep-expression-quote-char ?')
  (setq igrep-parenthesis-escape-char ?\\)

Howard

From owner-ntemacs-users@trout  Mon May 12 01:35:03 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "" "12" "May" "1997" "09:55:09" "+0200" "Harald Backer" "harald.backer@fou.telenor.no" nil "80" "Re: M-x grep (recursive?)" "^From:" nil nil "5" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id BAA13591 for <voelker@june.cs.washington.edu>; Mon, 12 May 1997 01:35:03 -0700
Received: from trout.cs.washington.edu (trout.cs.washington.edu [128.95.1.178]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id BAA36649 for <voelker@joker.cs.washington.edu>; Mon, 12 May 1997 01:35:01 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) with ESMTP id BAA25529 for <ntemacs-users@trout.cs.washington.edu>; Mon, 12 May 1997 01:00:09 -0700 (PDT)
Received: from mammon.nta.no (mammon.nta.no [193.156.18.66]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id BAA12779 for <ntemacs-users@cs.washington.edu>; Mon, 12 May 1997 01:00:06 -0700
Received: from NT-HBA.fou.telenor.no ([193.156.18.94]) by mammon.nta.no with SMTP id AA06693   (5.65c/IDA-1.4.4 for <ntemacs-users@cs.washington.edu>); Mon, 12 May 1997 09:59:58 +0200
References: <3370B3A4.6F0BE895@diffusion.com>
Mime-Version: 1.0 (generated by tm-edit 7.95)
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
In-Reply-To: Shahram Javey's message of Wed, 7 May 1997 19:10:29 +0000
Message-Id: <g1vtp1k2.fsf@fou.telenor.no>
Lines: 80
X-Mailer: Gnus v5.4.25/Emacs 19.34
From: Harald Backer <harald.backer@fou.telenor.no>
Sender: harald.backer@fou.telenor.no
To: Shahram Javey <sjavey@diffusion.com>
Cc: ntemacs-users@cs.washington.edu
Subject: Re: M-x grep (recursive?)
Date: 12 May 1997 09:55:09 +0200

Shahram Javey <sjavey@diffusion.com> writes:

> Hi, I want to be able to use "M-x grep" to search for a string in a
> given directory and all of its subdirectories. I still want the result
> in a *grep* buffer so that I could use "C-x `" to iterate through the
> files that conatin the matching string. How do I do that?

I use the igrep.el and globrep.el packages, see attachments for
descriptions.  They works fine (i.e. UNIX like:) with the Cygnus
ports.  Here are my settings for bash:

       (setq
       igrep-expression-quote-char ?'           ;I use bash
       igrep-parenthesis-escape-char ?\\)       ;I use bash

See also the find-dired package which comes with emacs.

Regards
Harald Backer, Telenor R&D, +47 73 543 918, harald.backer@fou.telenor.no


; igrep.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; igrep|Kevin Rodgers|kevinr@ihs.com|
;;; An improved interface to grep/egrep/fgrep; plus recursive `find` versio=
ns.|
;;; 97/02/10|2.56|~/misc/igrep.el.Z|

;;; 2. Put these forms in default.el or ~/.emacs:
;;;    (autoload (function igrep) "igrep"
;;;       "*Run `grep` PROGRAM to match EXPRESSION in FILES..." t)
;;;    (autoload (function igrep-find) "igrep"
;;;       "*Run `grep` via `find`..." t)
;;;    (autoload (function dired-do-igrep) "igrep"
;;;       "*Run `grep` on the marked (or next prefix ARG) files." t)
;;;    (autoload (function dired-do-igrep-find) "igrep"
;;;       "*Run `grep` via `find` on the marked (or next prefix ARG) direct=
ories." t)
;;; 2. a. For completeness, you can add these forms as well:
;;;    (autoload (function grep) "igrep"
;;;       "*Run `grep` PROGRAM to match EXPRESSION in FILES..." t)
;;;    (autoload (function egrep) "igrep"
;;;       "*Run `egrep`..." t)
;;;    (autoload (function fgrep) "igrep"
;;;       "*Run `fgrep`..." t)
;;;    (autoload (function agrep) "igrep"
;;;       "*Run `agrep`..." t)
;;;    (autoload (function grep-find) "igrep"
;;;       "*Run `grep` via `find`..." t)
;;;    (autoload (function egrep-find) "igrep"
;;;       "*Run `egrep` via `find`..." t)
;;;    (autoload (function fgrep-find) "igrep"
;;;       "*Run `fgrep` via `find`..." t)
;;;    (autoload (function agrep-find) "igrep"
;;;       "*Run `agrep` via `find`..." t)
;;;    (autoload (function dired-do-grep) "igrep"
;;;       "*Run `grep` on the marked (or next prefix ARG) files." t)
;;;    (autoload (function dired-do-grep-find) "igrep"
;;;       "*Run `grep` via `find` on the marked (or next prefix ARG) direct=
ories." t)
;;; 3. If you are running Windows 95/NT, you should install findutils
;;;    and grep from release 17.1 (or higher) of the Cygnus GNU-Win32
;;;    distribution.  See <URL:http://www.cygnus.com/misc/gnu-win32/>.

; globrep.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=
;;
; Fonction: Search and replace strings in multiple files.
; Cr=E9=E9    : 20 avril 90 --------- Martin Boyer <mboyer@ireq-robot.uucp>

;; This program can be used to search for and replace strings in
;; multiple files.  The idea is to find, in a set of files, all the
;; lines that contain a string to be changed.  Then, one can edit
;; the result of this search, and the program will take care of the
;; tedious task of splicing the changes back into the original files.

;; (autoload 'global-replace-lines "globrep"
;;           "Put back grepped lines" t)
;; (autoload 'global-replace "globrep"
;;           "query-replace across files" t)
;; (autoload 'global-grep-and-replace "globrep"
;;           "grep and query-replace across files" t)

