Reputation: 386
I'd like to be able to switch from an isearch
query directly into rgrep
(interactively) such that rgrep
defaults to using for the full isearch
query string. The default behavior of rgrep
is to use the symbol under the cursor, but this doesn't work well if the isearch
query contains spaces.
This recipe from EmacsWiki almost does what I want, but it calls rgrep
non-interactively whereas I'd like to call it interactively:
http://www.emacswiki.org/emacs/GrepFromIsearch
Upvotes: 0
Views: 49
Reputation: 386
Alright just figured it out — this seems to work:
(define-key isearch-mode-map "\C-xg"
(lambda()
(interactive)
(let ((read-regexp-defaults-function (lambda nil
(if isearch-regexp
isearch-string
(regexp-quote isearch-string)))))
(isearch-exit)
(call-interactively 'rgrep))))
Upvotes: 1