Using GNU Emacs for Windows search functions with SUA/Interix

Posted on

QUESTION :

I’m using GNU Emacs 23 for Windows (running on Windows 7 64-bit) and I’d like to be able to use search functions like M-x find-dired and M-x find-grep-dired.

The only Unix-like environment I am allowed access to is Services for Unix Applications (SUA, also known as Interix).

Has anyone managed to get this to work?

FWIW, I’ve tried creating a batch script called bash.bat with the following contents:

c:Windowsposix.exe /u /c //usr//local//bin//bash -l %*

This produces the following output, when executed in emacs using M-x find-dired

c:/Users/matthewd/:
find . ( _emacs ) -exec ls -ld {} ;
...    
c:Usersmatthewd>c:Windowsposix.exe /u /c //usr//local//bin//bash -l -c "find . ( _emacs ) -exec ls -ld {} ;" ...
Welcome to the SUA utilities.

DISPLAY=localhost:0.0
find: _emacs: unknown option

find exited abnormally with code 1 at Fri May 13 16:25:20

ANSWER :

Why don’t you open a shell (ksh, tcsh or bash) and run find and/or grep directly?
It would be a lot easier because then the login environment gets set and you won’t then be getting those errors.

You’ll find a link in the Start menu under “Subsystem for Unix-based Application” to the
shells.

If you want to use bash you can get it from the SUA Community site (along with
hundreds of other additional programs for free).

Leave a Reply

Your email address will not be published.