While using emacs I always find the need to use grep on a terminal to search for things within a specific project. This is not ideal, even within an embedded emacs shell.

Since I recently discovered the emacs command grep-find I decided to make it work nicely with mercurial projects, and here's the result:

(defun grep-project (s)
  (interactive "sSearch project for: ")
   (grep-find (concat "files=(`hg manifest`);grep -nH -e \"" s "\" ${files[@]/#/`hg root`/}"))
(global-set-key (quote [f4]) (quote grep-project))
blog entry of