merlin icon indicating copy to clipboard operation
merlin copied to clipboard

Identifier renaming also for Emacs?

Open dunric opened this issue 1 year ago • 4 comments

Vim's plugin offers a command to rename an identifier under a cursor (or passed as an argument), however I can't find a similar feature for Emacs. There is support for finding/highlight of identifier's occurrences but no for renaming?

edit: Reference to current Vim's implementation: merlin_find#IncrementalRename()

dunric avatar Mar 02 '24 00:03 dunric

I would expect there to be a standard way to rename occurrences from the occur-mode but maybe I am wrong ? @xvw do you use the standard merlin-mode for Emacs ? Do you know if such a feature exists ?

Anyway if it doesn't exists natively we would welcome a PR adding support for renaming :-)

voodoos avatar Mar 04 '24 09:03 voodoos

From my knowledge of occur, you can only use regular expressions to match specific lines and I must confess I don't know how to use them at all (and I don't think it's possible to rename).

In general, when I want to rename an identifier, I use xref-find-references-and-replace which uses merlin-occurences to find the occurrences of the term to be replaced.

xvw avatar Mar 04 '24 09:03 xvw

@xvw It seems xref-find-references-and-replace can mitigate the issue. Strange it didn't worked until merlin-eldoc package was installed.

dunric avatar Mar 07 '24 01:03 dunric

Indeed, I use Doom-emacs with the OCaml layout that includes merlin-eldoc. Interesting that it only works if eldoc is installed. I'll investigate.

xvw avatar Mar 07 '24 10:03 xvw