From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov 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 17:55:02 +0300 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19932"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 11 17:06:40 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 1oiGq7-0004zd-Ey for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 17:06:39 +0200 Original-Received: from localhost ([::1]:53862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiGq6-0006AO-4s for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 11:06:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiGfH-000641-LH for emacs-devel@gnu.org; Tue, 11 Oct 2022 10:55:28 -0400 Original-Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:36631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiGfE-0005py-M6; Tue, 11 Oct 2022 10:55:26 -0400 Original-Received: by mail-wm1-x32f.google.com with SMTP id c3-20020a1c3503000000b003bd21e3dd7aso10547276wma.1; Tue, 11 Oct 2022 07:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=v14IxBTaMTzgaBYsIIoTvqbkQBMBhdkGg53zA2JYKFw=; b=SHMgjIXaYX/uH36MGU2DiNHk3ieAXrapdST8tsEZvcKiy+3YJOlEDfI5keJNiLvfjH uy6CelP2TtRY4pvDTs3RcMpypRCvOflUfFMxlhUp9K6FBfBWdJpCZSmt2y/ICJ+0hINy gMA7msiZjqjPGkkDtdPTqp8sn6lJJkjhnZlOGEFjvSBq5ByI7oJezvLdAxTZHmEa+3R7 tseCwXYdi9fg8ljZoO7I00IszKwFuJz5G8OoHZEFbDsPUMHwE5BlkEQ5g1/RUEP9/Dol 4ldIeKNYsWvMIu8dYO6o4ld5Z+4SdkiVyJWrfdwAIdSKbmK1wslvBruOelX5mkoDgMtj umzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v14IxBTaMTzgaBYsIIoTvqbkQBMBhdkGg53zA2JYKFw=; b=e6Gb6L2V8RhAR189ygEGQ987IAFhlq6KhiXFmlj3IjX9GpmlkLmh7ccZWASdVkJ1CJ 4RGEOa9n9Bxk0fcVC03+PEIMMapWPnC1DPh8fR18c7wzwU2K6yXRyBMCBEzKeG+7O8Q3 Zs/rixgKHCvK5Ls6ji3ixwN19XJwy17acRhKrb3ZVXV1DI0TT2KOqApgci10egNvww/G OVR6wL6wfBxamyvgKN/91Bcb+G1OfqppSFCbZE9qFEGfjUd0u7lou0itUpYNQFZUZS+b DJrgNNgREX2ka3iXh8C/yAPf/koiqOC+r+8gKcVVTmz/KZsSIEK9HSN4m0+l1WtHvwn0 ASTg== X-Gm-Message-State: ACrzQf09kKHonNjczNcSrtbGhTG1Kt0R/anVaa1bXKDvJEewp47Vo5kT 3PsbmlZRaX+AglWOjKAvIxNQLL8bYhE= X-Google-Smtp-Source: AMsMyM46VsURQfNNkx6djjgV1ETiEWdme4qJKxrzWm3H66BoiDTjv+jUiCkiguB9EeX7wdq8RrURKQ== X-Received: by 2002:a05:600c:1c82:b0:3c6:c225:eb99 with SMTP id k2-20020a05600c1c8200b003c6c225eb99mr3695865wms.23.1665500105662; Tue, 11 Oct 2022 07:55:05 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bg1-20020a05600c3c8100b003a5f4fccd4asm19311844wmb.35.2022.10.11.07.55.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Oct 2022 07:55:05 -0700 (PDT) Content-Language: en-US In-Reply-To: <83sfjuecyw.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-2.934, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:297490 Archived-At: 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.