From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Uberti Newsgroups: gmane.emacs.devel Subject: Re: [Patch] Add project.el command to replace symbol at point throughout project Date: Tue, 11 Jan 2022 08:51:14 +0100 Message-ID: References: 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="16554"; 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 To: Jon Eskin , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 11 09:07:05 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 1n7CBN-0004AI-HF for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Jan 2022 09:07:05 +0100 Original-Received: from localhost ([::1]:44208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7CBM-0003dB-5d for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Jan 2022 03:07:04 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7BwA-0002Cx-PE for emacs-devel@gnu.org; Tue, 11 Jan 2022 02:51:22 -0500 Original-Received: from latitanza.investici.org ([82.94.249.234]:27885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7Bw8-0005YP-Ar for emacs-devel@gnu.org; Tue, 11 Jan 2022 02:51:22 -0500 Original-Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4JY2v81MDNzGp49; Tue, 11 Jan 2022 07:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inventati.org; s=stigmate; t=1641887476; bh=zPTiWwWf1qAHLsMLBWITcmr0IU0CZpQmnMOnqzNI9Ms=; h=Subject:To:References:From:Date:In-Reply-To:From; b=SYi8+DVcN8NJilTKf9dtrzM5kQ0YF5W3NuC/CNs6kqncnWaG0/XuuRKXKLnjrD12D TDpNVgW0f+6eEWoZOAdEgTVSm90lAsROzh50PkXOSx7/qJFliE8qjltCsqswlFNEpN AOntn/z4nDMW/PG/HipWidofbLhQ+OdnHj5iplAA= Original-Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: manuel.uberti@inventati.org) by localhost (Postfix) with ESMTPSA id 4JY2v80JsnzGp3t; Tue, 11 Jan 2022 07:51:15 +0000 (UTC) In-Reply-To: Content-Language: en-GB Received-SPF: pass client-ip=82.94.249.234; envelope-from=manuel.uberti@inventati.org; helo=latitanza.investici.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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:284579 Archived-At: On 11/01/22 08:45, Jon Eskin wrote: > Attached is a small patch adding command 'project-query-replace-at-point' to > project.el. The command is designed to improve the ergonomics of making a > project wide text replacement of a symbol at point. > > Currently, if you want to make a project wide replacement of a symbol using > project.el, the best options I've found are: > > - Mark the symbol you wish to replace > - Save symbol to kill ring with 'kill-ring-save' > - Enter command 'project-query-replace-regexp' > - Paste in the symbol, taking care to quote regex if necessary, and hit return > - Enter the replacement string and hit return > > or > > - Mark the symbol you wish to replace > - Save symbol to kill ring with 'kill-ring-save' > - Place cursor on symbol and enter command 'project-find-regexp' > - Hit return at the next prompt to accept the default prompt > - Enter command 'xref-query-replace-in-results' > - Enter the replacement string and hit return > > 'project-query-replace-at-point' regex-quotes the symbol at point and then calls > into the fileloop-initialize-replace function used by the existing > project-query-replace-regexp command. > > Replacing a symbol with 'project-query-replace-at-point' occurs as follows: > > - Place cursor on symbol and enter command 'project-query-replace-at-point' > - Enter the replacement string and hit return > > Let me know what you guys think. I haven't contributed before so please let me > know if I'm doing anything incorrectly. > I usually use the `project-find-regexp` approach you described, but I agree a simpler solution would be nicer. -- Manuel Uberti www.manueluberti.eu