Topics include: programming, Apple, Unix, gadgets, large-scale web sites and other nerdy stuff.

mkid-like hack for spotlight

2005-07-21 10:19:54

If you ever used the "mkid" package for finding references to functions in source files, you might appreciate this. I've tried to get the mkid package to compile on Mac OS X, but with no luck. It doesn't work that great with java, anyway, and has fallen into serious neglect. I guess everyone uses fancy IDEs nowadays anyway.

In any case, spotlight has a command line interface called mdfind. Try this little trick in your emacs. First, visit a source file at the top of your source tree. Then do M-x compile and give this command:

mdfind -onlyin `pwd` "println" | xargs grep -n "println"

Substitute whatever function or class or method you want for "println." Then use M-x next-error to walk through all occurences. Add key bindings and macros and have some refactoring fun.