From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel 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 19:01:12 +0300 Message-ID: <83k056e4dz.fsf@gnu.org> References: <83h70qhez0.fsf@gnu.org> <83edvuhaby.fsf@gnu.org> <831qruh67o.fsf@gnu.org> <83y1u2foli.fsf@gnu.org> <83zgehe6iq.fsf@gnu.org> <95113379-99d8-eba4-f980-a7fca11430d5@yandex.ru> <834jwfmn5a.fsf@gnu.org> <838rlohzeo.fsf@gnu.org> <83mta2g91p.fsf@gnu.org> <237a3e26-03b8-a2a9-90bd-d50c3670a131@yandex.ru> <83wn96efyn.fsf@gnu.org> <5bb803bf-f51b-c175-f908-c60066d6967d@yandex.ru> <83v8oqeeqf.fsf@gnu.org> <7c0849be-145e-e073-49b5-63749e8d8282@yandex.ru> <83sfjuecyw.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15835"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 11 18:20:31 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiHza-0003wn-Az for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 18:20:30 +0200 Original-Received: from localhost ([::1]:42608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiHzY-0002e9-IC for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 12:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiHh5-0007RJ-Ly for emacs-devel@gnu.org; Tue, 11 Oct 2022 12:01:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiHh2-0007ok-JK; Tue, 11 Oct 2022 12:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GGG4S7Psvf4M77ZEDngZTzgwvfxWpeZ9wMQT7i9qt8w=; b=IKLI8UDhXS2s NiEdo0GlM7EjgEPTm9fbw4E5mAFxWdObgrt+ahHH8gbW1XiCGoBf5Uz/rxmtHekd2PmTkJG8vFKMk etIROA1S/3bC8bAoNbAmIu8cTxx9Ut/P3x/4QOtT6vQhvsyJcJAa0ynU2YPGJyUaRL165+eUdOmlI RcnuGfpbORLjr47W+0ThFSwzf16HWc9ygODWkUATMcqxTagPK6BbZZeN3TMbrojgQJ3NjppaPPYfN FkfqtXCAAFKExu7KdimGIiL/CJr+AF2cfJ9rQqY0xJnHO1+PHWpvdLm+gM91b1ybtYTBcv5Bk2NsD uP69eht16XiRSL44iqKPuw==; Original-Received: from [87.69.77.57] (port=4357 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiHgj-0000TB-W5; Tue, 11 Oct 2022 12:01:14 -0400 In-Reply-To: (message from Dmitry Gutov on Tue, 11 Oct 2022 17:55:02 +0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297499 Archived-At: > Date: Tue, 11 Oct 2022 17:55:02 +0300 > Cc: emacs-devel@gnu.org > From: Dmitry Gutov > > 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. That's true. > > 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. I'm not trying to argue, I'm trying to find the best message text. It doesn't matter who suggested it first, what matters whether it is accurate and self-explanatory. > 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. What are the 10% of inaccuracy? If the message will only ever be shown when 'r' is invoked after M-., then what is inaccurate in it? > >> 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. No error message could possibly prevent that from happening, could it? > 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. But users can always invoke the command by name as well. > 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. Hmm... maybe Cannot perform global replacement in find-definition results Another idea would be for the error message to be constructed dynamically, and include the precise command that produced the Xref buffer, if xref.el could record that in some buffer-local variable.