ivy-xref icon indicating copy to clipboard operation
ivy-xref copied to clipboard

Adding occur-fn so that it can be used to rename variables

Open amosbird opened this issue 7 years ago • 4 comments

Currently ivy-xref doesn't work with wgrep-occur. It seems no suitable occur-fn is written. This would greatly help refactoring code.

amosbird avatar Oct 24 '18 07:10 amosbird

Can you point to existing emacs documentation regarding this? I am not familiar with what you mean by an occur-fn? I assume it has something to do with occur?

alexmurray avatar Oct 25 '18 10:10 alexmurray

When using counsel for example with ripgrep, you search for a string, then you can C-o and open results in ivy-occur buffer, then you can change to wgrep mode and modify things using multiple-cursors, iEdit, etc. When you're done editing you call wgrep-finish-edit and it will propagate changes to all files where the change has happened.

This is absolutely awesome feature, unfortunately ivy-xref can't do that. It still opens Occur buffer, but it doesn't let you change things - switching to wgrep doesn't work as with counsel-rg and even when you somehow manage to edit things, it doesn't know how to propagate changes back into files. I wonder how difficult would it be to build a sufficient "back-end", for this feature to work?

agzam avatar Feb 03 '20 08:02 agzam

This does sound like a great feature but I don't know where to start implementing it - if anyone can give a heads up that would be great.

alexmurray avatar Feb 03 '20 10:02 alexmurray

I'm not familiar with swiper and its code, but I think good place to start is to check how counsel implements it: https://github.com/abo-abo/swiper/blob/master/counsel.el#L3074

agzam avatar Feb 05 '20 06:02 agzam