|
From: | Dmitry Gutov |
Subject: | Re: [Patch] Add project.el command to replace symbol at point throughout project |
Date: | Thu, 13 Jan 2022 03:19:12 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 |
On 12.01.2022 14:45, Eli Zaretskii wrote:
Cc: emacs-devel@gnu.org From: Dmitry Gutov <dgutov@yandex.ru> Date: Wed, 12 Jan 2022 05:46:53 +0200 On 11.01.2022 15:10, Eli Zaretskii wrote:I think we should have such a command outside project.el as well. Would it be possible to base it on xref.el and related facilities, so that, for example, one could rename a symbol in all the files mentioned in TAGS table?We could add a command like xref-find-references-and-replace.That's what I had in mind. Perhaps it would even make sense to have that command automatically adjust itself to a project, when invoked in the context of a project?
The conceptual problem with that is we have a number of commands which produce a list of matches in an Xref buffer:
xref-find-references, xref-find-apropos, project-find-regexp, project-or-external-find-regexpThey're all fairly, so I won't think there's a change of implementing any meaningful automatic switching based on context.
Do we create the -and-replace counterpart only for xref-find-references?There's also dired-do-find-regexp for which we have added said counterpart already (dired-do-find-regexp-and-replace), but that was primarily for backward compatibility of the UI.
Or you can do a search with M-? and then press 'r'. Have you tried that?At some point. But I think someone who wants refactoring might have trouble discovering that, and a separate command will make that easier.
I rather remember the old recommendation to 'M-x find-grep-dired' followed by '% m RET .*' and 'M-x dired-do-query-replace-regexp', when one wanted to replace across the project. I think we're rather spoiled these days by comparison.
Anyway, if you're sure adding xref-find-references-and-replace will help, I've got no problem with that.
[Prev in Thread] | Current Thread | [Next in Thread] |