benma / visual-regexp.el

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

Can't advise vr--perform-query-replace #66

Open NicholasBHubbard opened 2 years ago

NicholasBHubbard commented 2 years ago

When I use vr/query-replace I would like the current replace candidate to always be centered on my screen. With the plain old query-replace I can get the desired behavior with following code:

(add-hook 'replace-update-post-hook #'recenter)

I could not find and similar hook for the visual-regexp package. I looked at the source code of the plain query-replace function and found that the replace-update-post-hook is called after perform-replace.

I then saw that vr/query-replace uses a similar function called vr--perform-query-replace, so I thought I could get the desired behavior with the following advice:

(advice-add 'vr--perform-query-replace :after #'recenter)

Unfortunately this advise has no effect.

How can I get similar behavior to replace-update-post-hook?

arstum commented 1 year ago

I also want to know.