Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grep failing with Emacs (windows), and GnuWin32 Grep

Tags:

grep

search

emacs

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 missing?

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?

like image 626
Andy Avatar asked Sep 05 '25 16:09

Andy


1 Answers

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

like image 181
Marius Andersen Avatar answered Sep 09 '25 08:09

Marius Andersen