Skip to content

Instantly share code, notes, and snippets.

@tychoish
Created February 12, 2014 18:19
Show Gist options
  • Save tychoish/8961437 to your computer and use it in GitHub Desktop.
Save tychoish/8961437 to your computer and use it in GitHub Desktop.
(defun smart-grep ()
(interactive)
(let ((search-text (buffer-substring-no-properties (region-beginning) (region-end)))
(file buffer-file-name))
(let ((search-dir (concat (substring file 0 (search "/src/" file)) "/src/"))
(search-extension (concat "*." (file-name-extension file))))
(rgrep search-text search-extension search-dir))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment