Skip to content

Instantly share code, notes, and snippets.

@jaycfields
Created November 3, 2012 17:48
Show Gist options
  • Save jaycfields/4008104 to your computer and use it in GitHub Desktop.
Save jaycfields/4008104 to your computer and use it in GitHub Desktop.
(defun grep-in-project ()
(interactive)
(er/mark-clj-word)
(let* ((project-root (locate-dominating-file
(file-name-directory (buffer-file-name)) "project.clj")))
(if project-root
(grep (concat "grep -nH -e "
(buffer-substring-no-properties (region-beginning) (region-end))
" -R " project-root))
(message (concat "no project.clj found at or below " (buffer-file-name))))))
(global-set-key (kbd "C-c g") 'grep-in-project)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment