Emacs tip: running ack in the project root w/rinari
This post covers how to combine the awesomeness of ack with rinari in emacs to run ack in the project root by default. (If you aren’t using ack, definitely check it out for searching your codebase. If you aren’t using emacs, this post isn’t going to convince you to switch).
I’ve been using Kim van Wyk’s ack.el for a few months now, but was annoyed that I had to tell it the directory where to run ack, when in most cases I wanted it to run in the root of my Rails app. So I copied the ack
function from ack.el and made one that only asks for the search pattern, then runs in the root of the app (provided by rinari’s rinari-root
function). I then bound that function to C-c f a
.
Here is the code:
Note: you will need rinari and ack.el loaded, and ack will need to be in your path.