tags:

views:

427

answers:

3

Hi,

I've downloaded and installed the GnuWin32 tools, and added the grep executables to the Emacs bin. I've also, for what its worth, added the GnuWin32 bin folder to my Path variable.

Problem is though, when I try and run with suggested grep commands, I always get:

Grep exited abnormally with code 53 at Wed Feb 24 17:16:12

For the life of me, I can't find any reference to error code 53 anywhere! :(

I've tried the exact examples on a number of websites for example, when I enter:

M-x grep <ret>

It comes up with

Run grep (like this): grep -n 

Which is fine, but I have no idea of what parameters it expects. I've tried some in some tuorials, but I get error code 53 again!

One of the things I've tried is straight from the emacs wiki (http://www.emacswiki.org/emacs/GrepMode#toc2) (maybe not for the windows version though?) and it says to try this command:

M-x grep -n -e setq ~/.emacs

Which I've tried and I get:

-*- mode: grep; default-directory: "c:/[My Directory]/" -*-
Grep started at Wed Feb 24 17:30:47

grep -n -e setq ~/.emacs NUL

Grep exited abnormally with code 53 at Wed Feb 24 17:30:47

So frustrating as this is meant to be a powerful feature of Emacs and I'm really trying to learn it as I've heard good things about it!

Any help would be appreciated! :)

Andy

UPDATE

From the suggestion below, I've tried it via command line and it seems to work fine, perhaps there some config I'm

UPDATE

I've found the command M-x Occur which seems to do much the same as I would image grep does. Are there many extra benefits to using grep over occur if I can't get this working?

A: 

The exit code of 53 is possibly an OS exit code rather than a grep-specific exit code. For windows this would be "The network path was not found". Are you doing anything over a network path? Are there any missing dll's that grep needs? Can you successfully run grep on the command line?

luapyad
Hi, thanks for the suggestions!I'm not doing anything over the network, so I'm not sure that'd be the problem. Just fired up cmd and it seems to work fine (at least no error code 53). I'm still not sure of the command syntax but I tried grep -n [regex] [file] and it seems to return search results. So why not with Emacs! Grrrr!!! :)
Andy
Can you check what version of emacs and grep (`grep --version` from command line) you are using.
luapyad
I'm using GNU grep 2.5.4 and emacs 23.1. I'm assumming they're the later (if not latest) versions as I only just downloaded it all a week or so ago. Thanks!
Andy
Sorry, more information about emacs: GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
Andy
Possibly it's a path problem. In your *scratch* buffer do a (getenv "PATH") and execute it with C-j. Is grep in that path?
stsquad
Yep, I've got the folder containing grep in the path (C:\GnuWin32\bin). I also read somewhere to copy the executables to the Emacs bin directory, which I've done. I think its so the GNU versions of commands like Find are used over the windows ones. Hmmm...
Andy
I wouldn't copy the executables to the emacs dir. Just put the dir on the system path, and make sure that when emacs starts, it uses that system path.
Cheeso
A: 

Download the dependencies zip file and copy libiconv2.dll, libintl3.dll, pcre3.dll and regex2.dll to Emacs' bin directory.

Copy grep.exe and find.exe to Emacs' own bin directory. Emacs will then use these files over any other executables with the same name, including Windows' own find utility.

Note: if you don't use the installer, you need to download the dependencies zip file as well and copy libiconv2.dll, libintl3.dll, pcre3.dll and regex2.dll to Emacs' bin directory, otherwise you may get an "exited abnormally with code 53" error message.

EmacsWiki: Grep Mode

Marius Andersen
A: 

Hi Andy,

I had a similar problem and the following worked for me.

  1. Go to the windows console
  2. Enter the command "set" to bring up your system variables
  3. I had shell=c:\progra~1\rational\ration~1\nutcroot\mksnt\sh.exe
  4. Enter "set shell=" to remove the variable
  5. Try Emacs again

Good luck!

Binh Nguyen
Hey,Thanks for the tip, but I gave up on Emacs ages ago, the learning curve was just too steep for what I was going to get out of it and I ended up using Notepad++ instead! :)..So unfortunately I can't test it!Andy
Andy