Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created January 2, 2013 19:18
Show Gist options
  • Save legumbre/4437063 to your computer and use it in GitHub Desktop.
Save legumbre/4437063 to your computer and use it in GitHub Desktop.
(defun isearch-find-grep ()
"Call `find-grep' with the last search string."
(interactive)
(grep-compute-defaults)
(let ((grep-host-defaults-alist)
(grep-find-command
(cons (replace-regexp-in-string " {}"
(concat isearch-string " {}")
(car grep-find-command))
(cdr grep-find-command))))
(grep-apply-setting 'grep-find-command grep-find-command)
(call-interactively #'find-grep)))
(define-key isearch-mode-map (kbd "M-s g") 'isearch-find-grep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment