Search code examples
emacsfindgrepackfind-grep

How to use ack with M-x find-grep?


Leaving question here for reference. The Lord alone knows why, but whereas once upon a time this didn't work for me, prompting me to ask this question, today it does. Typical bloody emacs. Also typically, it is an utter joy once you've wrestled with it a bit. YMMV.

These two commands:

find ~/myco -type f -print0 | xargs -0 -e grep -nH -e "setjmp"

and

ack --no-heading --no-color "setjmp" ~/myco

Seem to me to produce very similar results at the terminal.

And yet when I try to use the second as the command with M-x find-grep in emacs, it just prints the results, rather than hyperlinking and highlighting them as it would with the first.

Anyone know what is happening? Initial experiments with ack at the command line indicate that it blows find and grep out of the water, so it would be nice to be able to use it from emacs too.


Solution

  • On windows I call ack from find-grep e.g. like this:

    c:/xampp/perl/bin/perl.exe c:/bin/ack-standalone.txt --type-set java=.java --type=java -i information
    

    and it's working perfectly. The results are linked and colored in the grep buffer. I don't know why it doesn't work for you, but I can say it does work here.

    emacs version: GNU Emacs 23.2.1

    ack version: 1.94