The `ag` package (available on MELPA) has the ability to run `ag` only within your specified folder or in project root. Check out its [README](https://github.com/Wilfred/ag.el#running-a-search) on its github for more info. Here are some of the answers from this stackexchange the elaborate on the use of `ag` in emacs: * [What is the easiest way to search all useful files inside a single project?](http://emacs.stackexchange.com/a/453/115) * [Is there a way to use query-replace from grep/ack/ag output modes?](http://emacs.stackexchange.com/a/243/115)