emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xref-query-replace-in-results error message after xref-find-definiti


From: Dmitry Gutov
Subject: Re: xref-query-replace-in-results error message after xref-find-definitions, was: Re: bug#58158: 29.0.50; [overlay] Interval tree iteration considered harmful
Date: Tue, 11 Oct 2022 17:55:02 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

On 11.10.2022 15:55, Eli Zaretskii wrote:

But we can try to be helpful by offering an alternative:

    Cannot replace in this search; to rename a symbol, invoke
\\[xref-find-references] first

But then we'd need to name the other 2 commands as well, to be
accurate, yes?

If our conclusion is that the error is due to user trying to rename a symbol (and failing because xref-find-definitions's results don't allow them to do so), then xref-find-references is exactly the right suggestion.

Users who try to replace in regexp search matches don't see the error.

Perhaps I should remind that xref-find-definitions is still the main
exception -- where this command doesn't work.

But not the only one?

The only known one, so far.

So maybe just saying

   Cannot do global replacement using results of \\[xref-find-definitions]

should be okay?

Isn't it almost the same as I suggested upthread? Except I suggested "this search" instead of naming the specific command.

Do you think naming it will be helpful enough to sacrifice the 10% accuracy of the message? I suppose someone might have indeed forgotten that they did the search using xref-find-definitions.

That would mean that one 'r' can work in lsp-mode's
xref-find-definitions results (they define a bunch of custom commands
like lsp-find-definition and lsp-find-declaration, but that probably
doesn't matter). Not sure if we should do something about that.

If 'r' happens to work in that case, we don't have to worry about the
error message, right?

That's correct, but having the command succeed might be a problem by itself, couldn't it? It will rename the definitions (and/or declarations), but not other occurrences.

If we go in from this direction, we can have xref-show-definitions-buffer (the default xref-show-definitions-function) ensure that the binding for 'r' is set to some command that always reports an error (like 'cannot replace in definitions'), or is unbound.

This would do nothing for custom values of xref-show-definitions-function, but should remove most of the confusion with default configuration. And some non-default ones as well (lsp-mode doesn't change the value of xref-show-definitions-function).

If the docstring of xref-show-definitions-function looks okay to you, we can use its vocabulary.

  Cannot replace in definition search results

should cover xref-find-definitions, lsp-find-definition and lsp-find-declaration. Wouldn't help with lsp-find-implementation, though (its results are also questionable WRT renaming because they don't include all references either), but it won't make it worse.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]