benma / visual-regexp.el

A regexp/replace command for Emacs with interactive visual feedback
392 stars 28 forks source link

Provide an equivalent of isearch-query-replace-regexp #25

Closed cpitclaudel closed 9 years ago

cpitclaudel commented 9 years ago

In isearch mode, typing C-M-% launches isearch-query-replace-regexp, which in turn calls query-replace-regexp with the current search as the regexp search string.

Is there a simple way to achieve similar behaviour using vr? Ideally something like:

(require 'visual-regexp-steroids)
(define-key isearch-mode-map (kbd "C-M-%") 'vr/isearch-query-replace)
benma commented 9 years ago

I don't know of a very simple way. Seems as if you have to copy the isearch-query-replace function, replace the (perform-replace ...) part with something that calls vr--interactive-get-args, but with the regexp string already set. This functionality is not there and would probably require modifications to vr--interactive-get-args.

I do wonder why isearch-query-replace needs to be so long, seems like that could have been made a lot simpler.