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: [Patch] Add project.el command to replace symbol at point throughout project Date: Thu, 13 Jan 2022 03:19:12 +0200 Message-ID: References: <83zgo2770l.fsf@gnu.org> <83zgo15dhp.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="28360"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cc: eskinjp@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 13 02:23:24 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 1n7opo-0007Gt-28 for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Jan 2022 02:23:24 +0100 Original-Received: from localhost ([::1]:55202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7opm-0002bJ-Oo for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Jan 2022 20:23:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7onG-0001lf-83 for emacs-devel@gnu.org; Wed, 12 Jan 2022 20:20:46 -0500 Original-Received: from [2a00:1450:4864:20::42d] (port=43888 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7onC-0004x4-9u; Wed, 12 Jan 2022 20:20:45 -0500 Original-Received: by mail-wr1-x42d.google.com with SMTP id o3so7287740wrh.10; Wed, 12 Jan 2022 17:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=o84nnpH4rPL1vv0j7raXF8hnIUHvX4AQmvmNH+sTBH8=; b=dGlpdj9CoenPMqvklGhMEoPPpE7E8UlTBnivzdswDmeA8aQno7qfgZnLG6nU8dcWfy bvyaNJVbWYuDar/NXudkBt9xS1Vnt2Ym1Cdyc0bsLARfd7D5kLPEtV2JAH94zIsE0VkD XkvyJhbKN2h/oKrY06k+E31/0PbLrAOQQ9EvRVafI7bI1kbLzldqNO5P8nJIP4NfN+H/ txlINwXth8irqV5COOiT8hiLEP7/4iWkTa4cjP5E1gauMMmrJgM74gzG+LyhOgx7FyA4 itbNWktWCUOyMMkBvaCHEhrnUAdjmqSlqt28ce48U6K4aBfefEp++R+BfcVi0a3VDvL4 ve0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=o84nnpH4rPL1vv0j7raXF8hnIUHvX4AQmvmNH+sTBH8=; b=Thst9WP8tP52/RDpcxFtX95riakCOqyFRUsMnP521juOGCcy+IdiWw+wzKbmPxp2Lf wKHSN745a74NhPUZP4qTNpwHTYb+vm03QbThE7PXJuLmIFiWQpGZyEbnHuR+dPixAyfW dS4p6sD8cnyi6SJHQqqsVgiOqqIFjfDkSi9DQNILojoqChtbq62em1t2TDuGyjvhklcv EUO57m/hP6nT8HKue4hxPt/eBWYDKWAm/9F6jP5LznwPYjB5SKouAF523hQDnclDNWRY 1FAc6fVG94G5oCIqS6926oZ5onKaD58FyC4IBTBf/pxwDheiC5w+4TVK3kdShUm279BJ d1tQ== X-Gm-Message-State: AOAM531TxmzH/izYIGhhFKxAVtsfCyd9RflDjXXS2Q45qAVHbAbfMLiG QJwIK8B6yYmV4HhlSUe/gy9rrNuISes= X-Google-Smtp-Source: ABdhPJyvNIlZtrleeRFBcPzgWXCGnvJP6qeNzRcs40R3tT6jvs0W7TB0wHzq3bsqq+YURrJWot3jLw== X-Received: by 2002:adf:9e49:: with SMTP id v9mr1840183wre.469.1642036839971; Wed, 12 Jan 2022 17:20:39 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id m12sm1457895wrp.49.2022.01.12.17.20.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jan 2022 17:20:39 -0800 (PST) In-Reply-To: <83zgo15dhp.fsf@gnu.org> Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:284675 Archived-At: On 12.01.2022 14:45, Eli Zaretskii wrote: >> Cc: emacs-devel@gnu.org >> From: Dmitry Gutov >> 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-regexp They'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.