all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-12  9:21 Steinar Bang
@ 2012-04-12  8:39 ` Tassilo Horn
  2012-04-12  9:29 ` Eli Zaretskii
  1 sibling, 0 replies; 17+ messages in thread
From: Tassilo Horn @ 2012-04-12  8:39 UTC (permalink / raw)
  To: help-gnu-emacs

Steinar Bang <sb@dod.no> writes:

Hi Steinar,

> When I try to run rgrep it exits with no match, and in the *grep* I see
> the following error message:
>  C:\ProgramFiles\GnuWin32\bin\find: invalid expression; I was expecting to find a ')' somewhere but did not see one.
>
> The command line is:
> 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"
>
> Parantheses seems to be balanced...?

Yes, and the command works just fine on a GNU/Linux box...

> I haven't installed xargs, I think... unless that's part of
> FindUtils...?

It's part of GNU findutils, and the Win32 FindUtils say so, too:

  http://gnuwin32.sourceforge.net/packages/findutils.htm

Does it work if you provide the full patch to xargs in the command line,
e.g., C:\ProgramFiles\GnuWin32\bin\xargs?

Bye,
Tassilo




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

* Is it possible to run rgrep in emacs on Win32?
@ 2012-04-12  9:21 Steinar Bang
  2012-04-12  8:39 ` Tassilo Horn
  2012-04-12  9:29 ` Eli Zaretskii
  0 siblings, 2 replies; 17+ messages in thread
From: Steinar Bang @ 2012-04-12  9:21 UTC (permalink / raw)
  To: help-gnu-emacs

Platform: emacs 23.2.1,
          GnuWin32 FindUtils 4.2.20-2
          GnuWin32 Grep-2.5.4

Does anyone know of a way to make the emacs rgrep command work on
windows?

I'm trying to run `M-x rgrep RET' on a windows emacs.  I have installed
find and grep from GnuWin32 ( http://gnuwin32.sourceforge.net/ ) and put
them early in the PATH.

When I try to run rgrep it exits with no match, and in the *grep* I see
the following error message:
 C:\ProgramFiles\GnuWin32\bin\find: invalid expression; I was expecting to find a ')' somewhere but did not see one.

The command line is:
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"

Parantheses seems to be balanced...?  I haven't installed xargs, I
think... unless that's part of FindUtils...?



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-12  9:21 Steinar Bang
  2012-04-12  8:39 ` Tassilo Horn
@ 2012-04-12  9:29 ` Eli Zaretskii
  2012-04-12  9:37   ` Evgeniy Dolzhenko
                     ` (3 more replies)
  1 sibling, 4 replies; 17+ messages in thread
From: Eli Zaretskii @ 2012-04-12  9:29 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Steinar Bang <sb@dod.no>
> Date: Thu, 12 Apr 2012 11:21:41 +0200
> 
> Platform: emacs 23.2.1,
>           GnuWin32 FindUtils 4.2.20-2
>           GnuWin32 Grep-2.5.4

What version of Windows is that?

> Does anyone know of a way to make the emacs rgrep command work on
> windows?

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.  If that doesn't help, maybe advice below will.

"M-x rgrep" works for me on Windows XP, but I use Fiindutils that I
built myself, as the GnuWin32 provided port is broken (in particular,
xargs is affected).  You can find my port here:

  http://sourceforge.net/projects/ezwinports/files/

However, lately someone told me that my build doesn't work well on
Windows Vista and later, because Microsoft changed the way quoted
wildcards are processed by the startup code that globs them: now
wildcards are globbed even if they are quoted.  If you are using such
a new version of Windows, the only solution I know of is to downgrade
to an even older version 4.1 of Findutils from here:

  http://unxutils.sourceforge.net/

I think someone told me that this port does work on newer Windows
versions.

HTH



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-12  9:29 ` Eli Zaretskii
@ 2012-04-12  9:37   ` Evgeniy Dolzhenko
  2012-04-12 10:06   ` Stefan Vollmar
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Evgeniy Dolzhenko @ 2012-04-12  9:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs


Here is what works for me on Win7

;; Cygwin for find/grep
(setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH")))

in .emacs

1. GNU Emacs 24.0.94.1 (i386-mingw-nt6.1.7601)
2. CygWin in C:\cygwin some pretty outdated version

It's dog slow though :(

HTH,
Ev


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Steinar Bang <sb@dod.no>
>> Date: Thu, 12 Apr 2012 11:21:41 +0200
>> 
>> Platform: emacs 23.2.1,
>>           GnuWin32 FindUtils 4.2.20-2
>>           GnuWin32 Grep-2.5.4
>
> What version of Windows is that?
>
>> Does anyone know of a way to make the emacs rgrep command work on
>> windows?
>
> 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.  If that doesn't help, maybe advice below will.
>
> "M-x rgrep" works for me on Windows XP, but I use Fiindutils that I
> built myself, as the GnuWin32 provided port is broken (in particular,
> xargs is affected).  You can find my port here:
>
>   http://sourceforge.net/projects/ezwinports/files/
>
> However, lately someone told me that my build doesn't work well on
> Windows Vista and later, because Microsoft changed the way quoted
> wildcards are processed by the startup code that globs them: now
> wildcards are globbed even if they are quoted.  If you are using such
> a new version of Windows, the only solution I know of is to downgrade
> to an even older version 4.1 of Findutils from here:
>
>   http://unxutils.sourceforge.net/
>
> I think someone told me that this port does work on newer Windows
> versions.
>
> HTH



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

* Re: Is it possible to run rgrep in emacs on Win32?
  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
  3 siblings, 0 replies; 17+ messages in thread
From: Stefan Vollmar @ 2012-04-12 10:06 UTC (permalink / raw)
  To: Eli Zaretskii, sb; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]

You might also want to look at "ack" which can be used as an alternative to rgrep: http://betterthangrep.com
We have used it from Emacs on several platforms, including Windows, and it works very well for us (on Windows it would require installing one of the free Perl packages - which is not difficult at all).

Warm regards,
 Stefan


On 12.04.2012, at 11:29, Eli Zaretskii wrote:

>> From: Steinar Bang <sb@dod.no>
>> Date: Thu, 12 Apr 2012 11:21:41 +0200
>> 
>> Platform: emacs 23.2.1,
>>          GnuWin32 FindUtils 4.2.20-2
>>          GnuWin32 Grep-2.5.4
> 
> What version of Windows is that?
> 
>> Does anyone know of a way to make the emacs rgrep command work on
>> windows?
> 
> 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.  If that doesn't help, maybe advice below will.
> 
> "M-x rgrep" works for me on Windows XP, but I use Fiindutils that I
> built myself, as the GnuWin32 provided port is broken (in particular,
> xargs is affected).  You can find my port here:
> 
>  http://sourceforge.net/projects/ezwinports/files/
> 
> However, lately someone told me that my build doesn't work well on
> Windows Vista and later, because Microsoft changed the way quoted
> wildcards are processed by the startup code that globs them: now
> wildcards are globbed even if they are quoted.  If you are using such
> a new version of Windows, the only solution I know of is to downgrade
> to an even older version 4.1 of Findutils from here:
> 
>  http://unxutils.sourceforge.net/
> 
> I think someone told me that this port does work on newer Windows
> versions.
> 
> HTH
> 

-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de   http://www.nf.mpg.de









[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4409 bytes --]

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

* Re: Is it possible to run rgrep in emacs on Win32?
  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
  3 siblings, 0 replies; 17+ messages in thread
From: Thierry Volpiatto @ 2012-04-12 10:07 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Steinar Bang <sb@dod.no>
>> Date: Thu, 12 Apr 2012 11:21:41 +0200
>> 
>> Platform: emacs 23.2.1,
>>           GnuWin32 FindUtils 4.2.20-2
>>           GnuWin32 Grep-2.5.4
>
> What version of Windows is that?
>
>> Does anyone know of a way to make the emacs rgrep command work on
>> windows?
>
> 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.  If that doesn't help, maybe advice below will.
>
> "M-x rgrep" works for me on Windows XP, but I use Fiindutils that I
> built myself, as the GnuWin32 provided port is broken (in particular,
> xargs is affected).  You can find my port here:
>
>   http://sourceforge.net/projects/ezwinports/files/
>
> However, lately someone told me that my build doesn't work well on
> Windows Vista and later, because Microsoft changed the way quoted
> wildcards are processed by the startup code that globs them: now
> wildcards are globbed even if they are quoted.  If you are using such
> a new version of Windows, the only solution I know of is to downgrade
> to an even older version 4.1 of Findutils from here:
>
>   http://unxutils.sourceforge.net/
>
> I think someone told me that this port does work on newer Windows
> versions.
>
> HTH
>
>
I suggest you use https://github.com/emacs-helm/helm
which work out of the box with recursive grep and doesn't need find and
xargs, only Gnuwin32 grep >=2.5.4.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-12 15:26   ` Steinar Bang
@ 2012-04-12 14:13     ` Eli Zaretskii
  2012-04-13 11:34     ` Steinar Bang
  1 sibling, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2012-04-12 14:13 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Steinar Bang <sb@dod.no>
> Date: Thu, 12 Apr 2012 17:26:03 +0200
> 
> > However, lately someone told me that my build doesn't work well on
> > Windows Vista and later,
> 
> 2008 R2 will qualify there.  It is on the same generation as Win7 I
> think...? 

Yes, it is.



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-12  9:29 ` Eli Zaretskii
                     ` (2 preceding siblings ...)
  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
  3 siblings, 2 replies; 17+ messages in thread
From: Steinar Bang @ 2012-04-12 15:26 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Eli Zaretskii <eliz@gnu.org>:

> What version of Windows is that?

2008 Server R2 SP1.

> 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!

> If that doesn't help, maybe advice below will.

> "M-x rgrep" works for me on Windows XP, but I use Fiindutils that I
> built myself, as the GnuWin32 provided port is broken (in particular,
> xargs is affected).  You can find my port here:

>   http://sourceforge.net/projects/ezwinports/files/

Thanks again!  Will look at this one as well.

> However, lately someone told me that my build doesn't work well on
> Windows Vista and later,

2008 R2 will qualify there.  It is on the same generation as Win7 I
think...? 

> because Microsoft changed the way quoted wildcards are processed by
> the startup code that globs them: now wildcards are globbed even if
> they are quoted.  If you are using such a new version of Windows, the
> only solution I know of is to downgrade to an even older version 4.1
> of Findutils from here:

>   http://unxutils.sourceforge.net/

> I think someone told me that this port does work on newer Windows
> versions.

Ok.  Will try this one as well if none of the above works.

Thanks!



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-12 15:26   ` Steinar Bang
  2012-04-12 14:13     ` Eli Zaretskii
@ 2012-04-13 11:34     ` Steinar Bang
  2012-04-13 12:12       ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Steinar Bang @ 2012-04-13 11:34 UTC (permalink / raw)
  To: help-gnu-emacs

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



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-13 11:34     ` Steinar Bang
@ 2012-04-13 12:12       ` Eli Zaretskii
  2012-04-13 13:02         ` Evgeniy Dolzhenko
  2012-04-14  8:03         ` Steinar Bang
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2012-04-13 12:12 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Steinar Bang <sb@dod.no>
> Date: Fri, 13 Apr 2012 13:34:09 +0200
> 
> 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")

You will be much better off, including with other ports of GNU/Unix
software, if you just put them all on PATH.  I see no good reason for
keeping them in a directory that is not on PATH.  Not every program
called by Emacs has a user option that allows you to spell out its
full absolute file name.

(FWIW, I have a single `bin' directory into which I put _all_ the
programs and DLLs that do not come with Windows out of the box, and
that directory is very near the beginning of PATH.  I have yet to see
a single use case where this arrangement failed me, be it in Emacs or
elsewhere.  So this is what I recommend to others, unless there are
_very_ good reasons not to use this setup.)



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

* Re: Is it possible to run rgrep in emacs on Win32?
  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
  1 sibling, 2 replies; 17+ messages in thread
From: Evgeniy Dolzhenko @ 2012-04-13 13:02 UTC (permalink / raw)
  To: help-gnu-emacs

Since my comment about this setup being dog slow went unnoticed I'd like 
to reiterate find+xargs+grep are really slow on Windows on just 
moderately large projects, so I'm looking for a solution to this? Is it 
switching to ack?

Maybe somebody will post an example config for recent Emacs/ack versions?

Cheers,
Ev

On 4/13/2012 4:12 PM, Eli Zaretskii wrote:
>> From: Steinar Bang<sb@dod.no>
>> Date: Fri, 13 Apr 2012 13:34:09 +0200
>>
>> 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")
>
> You will be much better off, including with other ports of GNU/Unix
> software, if you just put them all on PATH.  I see no good reason for
> keeping them in a directory that is not on PATH.  Not every program
> called by Emacs has a user option that allows you to spell out its
> full absolute file name.
>
> (FWIW, I have a single `bin' directory into which I put _all_ the
> programs and DLLs that do not come with Windows out of the box, and
> that directory is very near the beginning of PATH.  I have yet to see
> a single use case where this arrangement failed me, be it in Emacs or
> elsewhere.  So this is what I recommend to others, unless there are
> _very_ good reasons not to use this setup.)
>




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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-13 13:02         ` Evgeniy Dolzhenko
@ 2012-04-13 17:42           ` Eli Zaretskii
  2012-04-14 15:14           ` Stefan Vollmar
  1 sibling, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2012-04-13 17:42 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 13 Apr 2012 17:02:32 +0400
> From: Evgeniy Dolzhenko <dolzenko@gmail.com>
> 
> Since my comment about this setup being dog slow went unnoticed I'd like 
> to reiterate find+xargs+grep are really slow on Windows on just 
> moderately large projects

It is only slow if you use the GnuWin32 port of GNU Find.  (They used
a version of `readdir' which traded a marginal feature for abysmally
slow performance.)  That was the original reason why I made my own
port, which is between 4 and 10 times faster.  Give it a try.



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-13 12:12       ` Eli Zaretskii
  2012-04-13 13:02         ` Evgeniy Dolzhenko
@ 2012-04-14  8:03         ` Steinar Bang
  2012-04-14  9:04           ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Steinar Bang @ 2012-04-14  8:03 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Eli Zaretskii <eliz@gnu.org>:

> You will be much better off, including with other ports of GNU/Unix
> software, if you just put them all on PATH.  I see no good reason for
> keeping them in a directory that is not on PATH. 

The cmd.exe on my development box have their own utilities with the same
names and different argument, and I don't want to confuse other
utilities in my development environment (which I don't control myself).
Things might stop building because I want rgrep in Gnus.

> Not every program called by Emacs has a user option that allows you to
> spell out its full absolute file name.

I know.  I was very happy to find out that grep.el did.

> (FWIW, I have a single `bin' directory into which I put _all_ the
> programs and DLLs that do not come with Windows out of the box, and
> that directory is very near the beginning of PATH.  I have yet to see
> a single use case where this arrangement failed me, be it in Emacs or
> elsewhere.  So this is what I recommend to others, unless there are
> _very_ good reasons not to use this setup.)

Yes.  It's what I would do on a box completely under my control.




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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-14  8:03         ` Steinar Bang
@ 2012-04-14  9:04           ` Eli Zaretskii
  2012-04-16 13:26             ` Ludwig, Mark
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2012-04-14  9:04 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Steinar Bang <sb@dod.no>
> Date: Sat, 14 Apr 2012 10:03:26 +0200
> 
> >>>>> Eli Zaretskii <eliz@gnu.org>:
> 
> > You will be much better off, including with other ports of GNU/Unix
> > software, if you just put them all on PATH.  I see no good reason for
> > keeping them in a directory that is not on PATH. 
> 
> The cmd.exe on my development box have their own utilities with the same
> names and different argument, and I don't want to confuse other
> utilities in my development environment (which I don't control myself).
> Things might stop building because I want rgrep in Gnus.

There's more than one way of cutting this cake.

You could create a special batch file that modifies PATH before it
runs Emacs.  You can then make the desktop shortcut which runs Emacs
run that batch file instead.  Or you could invoke the batch file
manually from a command shell before running Emacs from that shell.
You can even have a separate shortcut for starting a special-purpose
cmd.exe window, which starts by running that batch file (via the "cmd
/k foo.bat" feature).

I think one of these methods could fit your workflow without adversely
affecting those other utilities.



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

* Re: Is it possible to run rgrep in emacs on Win32?
  2012-04-13 13:02         ` Evgeniy Dolzhenko
  2012-04-13 17:42           ` Eli Zaretskii
@ 2012-04-14 15:14           ` Stefan Vollmar
  1 sibling, 0 replies; 17+ messages in thread
From: Stefan Vollmar @ 2012-04-14 15:14 UTC (permalink / raw)
  To: Evgeniy Dolzhenko; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2470 bytes --]

Dear Evgeniy,

there are several links to Emacs ack setups here: http://www.emacswiki.org/emacs/Ack

I noticed that there was no such link on the ack homepage and wrote to ack's maintainer, Andy Lester - he kindly added the link to emacswiki yesterday: http://betterthangrep.com/more-tools. We use ack on several platforms and apparently on Windows it has several advantages.

Warm regards,
 Stefan

On 13.04.2012, at 15:02, Evgeniy Dolzhenko wrote:

> Since my comment about this setup being dog slow went unnoticed I'd like to reiterate find+xargs+grep are really slow on Windows on just moderately large projects, so I'm looking for a solution to this? Is it switching to ack?
> 
> Maybe somebody will post an example config for recent Emacs/ack versions?
> 
> Cheers,
> Ev
> 
> On 4/13/2012 4:12 PM, Eli Zaretskii wrote:
>>> From: Steinar Bang<sb@dod.no>
>>> Date: Fri, 13 Apr 2012 13:34:09 +0200
>>> 
>>> 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")
>> 
>> You will be much better off, including with other ports of GNU/Unix
>> software, if you just put them all on PATH.  I see no good reason for
>> keeping them in a directory that is not on PATH.  Not every program
>> called by Emacs has a user option that allows you to spell out its
>> full absolute file name.
>> 
>> (FWIW, I have a single `bin' directory into which I put _all_ the
>> programs and DLLs that do not come with Windows out of the box, and
>> that directory is very near the beginning of PATH.  I have yet to see
>> a single use case where this arrangement failed me, be it in Emacs or
>> elsewhere.  So this is what I recommend to others, unless there are
>> _very_ good reasons not to use this setup.)
>> 
> 
> 

-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de   http://www.nf.mpg.de









[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4409 bytes --]

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

* RE: Is it possible to run rgrep in emacs on Win32?
  2012-04-14  9:04           ` Eli Zaretskii
@ 2012-04-16 13:26             ` Ludwig, Mark
  0 siblings, 0 replies; 17+ messages in thread
From: Ludwig, Mark @ 2012-04-16 13:26 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs@gnu.org

> From: Eli Zaretskii
> Sent: Saturday, April 14, 2012 4:05 AM
> To: help-gnu-emacs@gnu.org
> Subject: Re: Is it possible to run rgrep in emacs on Win32?
> 
> > From: Steinar Bang <sb@dod.no>
> > Date: Sat, 14 Apr 2012 10:03:26 +0200
> >
> > >>>>> Eli Zaretskii <eliz@gnu.org>:
> >
> > > You will be much better off, including with other ports of GNU/Unix
> > > software, if you just put them all on PATH.  I see no good reason for
> > > keeping them in a directory that is not on PATH.
> >
> > The cmd.exe on my development box have their own utilities with the
> same
> > names and different argument, and I don't want to confuse other
> > utilities in my development environment (which I don't control myself).
> > Things might stop building because I want rgrep in Gnus.
> 
> There's more than one way of cutting this cake.
> 
> You could create a special batch file that modifies PATH before it
> runs Emacs.  You can then make the desktop shortcut which runs Emacs
> run that batch file instead.  Or you could invoke the batch file
> manually from a command shell before running Emacs from that shell.
> You can even have a separate shortcut for starting a special-purpose
> cmd.exe window, which starts by running that batch file (via the "cmd
> /k foo.bat" feature).
> 
> I think one of these methods could fit your workflow without adversely
> affecting those other utilities.

I suppose my situation is different, but am I the only person who uses the Windows-native FINDSTR utility?

(require 'compile)
(setq grep-command "findstr /n ")

The syntax is of course completely different, and there are certainly significant RegExp differences, but it ignores the "NUL" that appears at the end of the command so basically works and its syntax is similar-enough to grep's that I can mostly forget which one I'm using.  (I'm a programmer, so generally am searching for a single word such as a function name....)  

I just add the /S option when I want recursive descent behavior....

Cheers,
Mark




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

* Re: Is it possible to run rgrep in emacs on Win32?
       [not found] <mailman.1131.1334218896.20052.help-gnu-emacs@gnu.org>
@ 2012-04-17  5:47 ` winterTTr
  0 siblings, 0 replies; 17+ messages in thread
From: winterTTr @ 2012-04-17  5:47 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-gnu-emacs

On Thursday, April 12, 2012 5:21:41 PM UTC+8, Steinar Bang wrote:
> Platform: emacs 23.2.1,
>           GnuWin32 FindUtils 4.2.20-2
>           GnuWin32 Grep-2.5.4
> 
> Does anyone know of a way to make the emacs rgrep command work on
> windows?
> 
> I'm trying to run `M-x rgrep RET' on a windows emacs.  I have installed
> find and grep from GnuWin32 ( http://gnuwin32.sourceforge.net/ ) and put
> them early in the PATH.
> 
> When I try to run rgrep it exits with no match, and in the *grep* I see
> the following error message:
>  C:\ProgramFiles\GnuWin32\bin\find: invalid expression; I was expecting to find a ')' somewhere but did not see one.
> 
> The command line is:
> 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"
> 
> Parantheses seems to be balanced...?  I haven't installed xargs, I
> think... unless that's part of FindUtils...?

I suggest to not use the xargs style. Currently, I almost cannot find a good "find.exe" and "xrags.exe" to work well together.

What I currently used is, using the binary folder comes from msysgit, which should be the find.exe and grep.exe from msys sub system.

At the same time, do not use xargs style for rgrep.

(require 'grep)
(grep-apply-setting
 'grep-find-use-xargs 'exec)

use 'exec style, which you can get more information from grep-find-use-xargs documentation.

The currently problem is, this kind of combination is very slow if you use it to find deep directory tree. However, it at least can use without any problem.


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

end of thread, other threads:[~2012-04-17  5:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1131.1334218896.20052.help-gnu-emacs@gnu.org>
2012-04-17  5:47 ` Is it possible to run rgrep in emacs on Win32? winterTTr
2012-04-12  9:21 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
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

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.