Closed Inc0n closed 3 years ago
I am not sure I understand. Can you rephrase it please?
In other words I would like to have something like (vr/replace "evil" nil nil nil)
possible, where a regexp is passed in, but a replacement would still need to be prompted. So, the first prompt of the regex string to be replaced can be skipped and passed in as an argument, but the function could still proceed to ask for replacement string.
I will not add this feature to the main package, but you can achieve your goal by doing something like this locally:
(flet ((vr--set-regexp-string () (setq vr--regexp-string "MY-REGEXP"))) (call-interactively 'vr/query-replace))
That's great, thank you very much!
Hi benma,
Thanks again for the solution provided, however, in recent times this solution hasn't worked. As I have start using Emacs 28. I made some minor modification to make it work:
(cl-letf (((symbol-function 'vr--set-regexp-string)
(lambda () (setq vr--regexp-string regexp-string))))
(call-interactively 'vr/query-replace))
And of course, regexp-string
will be the regexp to query to be replaced.
For example, I could invoke
vr/query-replace
, it could for example take in the symbol at the point to be the regex string to be replaced, but it would continue to prompt for replacement. This way I could get the visual fancies from this package.