all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Re: Is it possible to run rgrep in emacs on Win32?
Date: Fri, 13 Apr 2012 13:34:09 +0200	[thread overview]
Message-ID: <yb0lilz50i6.fsf@dod.no> (raw)
In-Reply-To: <yb0zkah3uoy.fsf@dod.no> (Steinar Bang's message of "Thu, 12 Apr 2012 17:26:03 +0200")

>>>>> Steinar Bang <sb@dod.no>:
>>>>> Eli Zaretskii <eliz@gnu.org>:

>> First, try Emacs 23.3 or later, there were some changes made there to
>> fix problems with very long command lines, perhaps you are hitting
>> that limit. 

> Thanks!  Will try!

Tried emacs 23.4 which was the newest 23.x available.  That got me a bit
further:

C:\ProgramFiles\GnuWin32\bin\find . "(" -path "*/SCCS" -o -path "*/RCS" -o -path "*/CVS" -o -path "*/MCVS" -o -path "*/.svn" -o -path "*/.git" -o -path "*/.hg" -o -path "*/.bzr" -o -path "*/_MTN" -o -path "*/_darcs" -o -path "*/{arch}" ")" -prune -o "(" -name ".#*" -o -name "*.o" -o -name "*~" -o -name "*.bin" -o -name "*.bak" -o -name "*.obj" -o -name "*.map" -o -name "*.ico" -o -name "*.pif" -o -name "*.lnk" -o -name "*.a" -o -name "*.ln" -o -name "*.blg" -o -name "*.bbl" -o -name "*.dll" -o -name "*.drv" -o -name "*.vxd" -o -name "*.386" -o -name "*.elc" -o -name "*.lof" -o -name "*.glo" -o -name "*.idx" -o -name "*.lot" -o -name "*.fmt" -o -name "*.tfm" -o -name "*.class" -o -name "*.fas" -o -name "*.lib" -o -name "*.mem" -o -name "*.x86f" -o -name "*.sparcf" -o -name "*.fasl" -o -name "*.ufsl" -o -name "*.fsl" -o -name "*.dxl" -o -name "*.pfsl" -o -name "*.dfsl" -o -name "*.p64fsl" -o -name "*.d64fsl" -o -name "*.dx64fsl" -o -name "*.lo" -o -name "*.la" -o -name "*.gmo" -o -name "*.mo" -o -name "*.toc" -o -name "*.aux" -o -name "*.cp" -o -name "*.fn" -o -name "*.ky" -o -name "*.pg" -o -name "*.tp" -o -name "*.vr" -o -name "*.cps" -o -name "*.fns" -o -name "*.kys" -o -name "*.pgs" -o -name "*.tps" -o -name "*.vrs" -o -name "*.pyc" -o -name "*.pyo" ")" -prune -o  -type f "(" -iname "*.csproj" ")" -print0 | "xargs" -0 -e grep -i -nH -e "searchterm"
'"xargs"' is not recognized as an internal or external command,
operable program or batch file.

In my .emacs I had the following:
;; Make rgrep find the find program from GnuWin32
(setq find-program "C:\\ProgramFiles\\GnuWin32\\bin\\find")

So I looked in grep.el (which defines the find-program variable) and
found that it had an xargs-program variable as well.  Defined it like
this in .emacs (note that it is necessary to start a new emacs for the
changes to take effect.  Just evaluating that setq in the *scratch*
buffer won't work):
;; Make rgrep find the xargs program from GnuWin32
(setq xargs-program "C:\\ProgramFiles\\GnuWin32\\bin\\xargs")

This worked better, but I got a more or less expected error message that
it couldn't find "grep":

C:\ProgramFiles\GnuWin32\bin\find . "(" -path "*/SCCS" -o -path "*/RCS" -o -path "*/CVS" -o -path "*/MCVS" -o -path "*/.svn" -o -path "*/.git" -o -path "*/.hg" -o -path "*/.bzr" -o -path "*/_MTN" -o -path "*/_darcs" -o -path "*/{arch}" ")" -prune -o "(" -name ".#*" -o -name "*.o" -o -name "*~" -o -name "*.bin" -o -name "*.bak" -o -name "*.obj" -o -name "*.map" -o -name "*.ico" -o -name "*.pif" -o -name "*.lnk" -o -name "*.a" -o -name "*.ln" -o -name "*.blg" -o -name "*.bbl" -o -name "*.dll" -o -name "*.drv" -o -name "*.vxd" -o -name "*.386" -o -name "*.elc" -o -name "*.lof" -o -name "*.glo" -o -name "*.idx" -o -name "*.lot" -o -name "*.fmt" -o -name "*.tfm" -o -name "*.class" -o -name "*.fas" -o -name "*.lib" -o -name "*.mem" -o -name "*.x86f" -o -name "*.sparcf" -o -name "*.fasl" -o -name "*.ufsl" -o -name "*.fsl" -o -name "*.dxl" -o -name "*.pfsl" -o -name "*.dfsl" -o -name "*.p64fsl" -o -name "*.d64fsl" -o -name "*.dx64fsl" -o -name "*.lo" -o -name "*.la" -o -name "*.gmo" -o -name "*.mo" -o -name "*.toc" -o -name "*.aux" -o -name "*.cp" -o -name "*.fn" -o -name "*.ky" -o -name "*.pg" -o -name "*.tp" -o -name "*.vr" -o -name "*.cps" -o -name "*.fns" -o -name "*.kys" -o -name "*.pgs" -o -name "*.tps" -o -name "*.vrs" -o -name "*.pyc" -o -name "*.pyo" ")" -prune -o  -type f "(" -iname "*.csproj" ")" -print0 | "C:\ProgramFiles\GnuWin32\bin\xargs" -0 -e grep -i -nH -e "searchterm"
C:\ProgramFiles\GnuWin32\bin\xargs: grep: No such file or directory

So I added the following to .emacs, and started a fresh emacs 23.4
instance:
;; Make rgrep find the grep program from GnuWin32
(setq grep-program "C:\\ProgramFiles\\GnuWin32\\bin\\grep")

Success!

So in summary:
 - Use emacs 23.4
 - Install FindUtils and grep from GnuWin32 http://gnuwin32.sourceforge.net/
 - Set variables in .emacs to whereever you installed the GnuWin32
   binaries:
    ;; Make rgrep find the GnuWin32 executables it needs
    (setq find-program "C:\\ProgramFiles\\GnuWin32\\bin\\find")
    (setq xargs-program "C:\\ProgramFiles\\GnuWin32\\bin\\xargs")
    (setq grep-program "C:\\ProgramFiles\\GnuWin32\\bin\\grep")

(The use "C:\ProgramFiles" for the GnuWin32 location, is just an old
habit of mine, to give ported unix programs an installation path with no
spaces)



  parent reply	other threads:[~2012-04-13 11:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12  9:21 Is it possible to run rgrep in emacs on Win32? Steinar Bang
2012-04-12  8:39 ` Tassilo Horn
2012-04-12  9:29 ` Eli Zaretskii
2012-04-12  9:37   ` Evgeniy Dolzhenko
2012-04-12 10:06   ` Stefan Vollmar
2012-04-12 10:07   ` Thierry Volpiatto
2012-04-12 15:26   ` Steinar Bang
2012-04-12 14:13     ` Eli Zaretskii
2012-04-13 11:34     ` Steinar Bang [this message]
2012-04-13 12:12       ` Eli Zaretskii
2012-04-13 13:02         ` Evgeniy Dolzhenko
2012-04-13 17:42           ` Eli Zaretskii
2012-04-14 15:14           ` Stefan Vollmar
2012-04-14  8:03         ` Steinar Bang
2012-04-14  9:04           ` Eli Zaretskii
2012-04-16 13:26             ` Ludwig, Mark
     [not found] <mailman.1131.1334218896.20052.help-gnu-emacs@gnu.org>
2012-04-17  5:47 ` winterTTr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yb0lilz50i6.fsf@dod.no \
    --to=sb@dod.no \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.