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: Wed, 12 Jan 2022 05:42:34 +0200 Message-ID: <88e2f28a-925b-551c-b85b-0af400997dc5@yandex.ru> 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="30721"; 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 Wed Jan 12 04:44:55 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 1n7UZD-0007jr-4v for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Jan 2022 04:44:55 +0100 Original-Received: from localhost ([::1]:42962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7UZB-00046j-HM for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Jan 2022 22:44:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:32950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7UYR-0003S5-5r for emacs-devel@gnu.org; Tue, 11 Jan 2022 22:44:07 -0500 Original-Received: from [2a00:1450:4864:20::42d] (port=41767 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 1n7UYP-0004oz-9o for emacs-devel@gnu.org; Tue, 11 Jan 2022 22:44:06 -0500 Original-Received: by mail-wr1-x42d.google.com with SMTP id v6so1754178wra.8 for ; Tue, 11 Jan 2022 19:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bMT7iFyTAOueHgEVSqDZ8kKdm4uU+X+OUXiV+KzwJN4=; b=C2V3e7/bMP9qKyd75VdA93jO/x8rwAQcdHbmiogrqfaTc61QFw/dajhIxcprFxisLB oduwE3pJSmoitGWc61zYHmUxVBCi6+z51BJfyW1uwPJiTIm4Uap6GGSTx+fsa8RKlvax U/GZSiAdydXgCgoh32aAxBNULkUeX3Dt8hcR2zsrqiY4qXqu9lCh88HwrDA5VpEm2nvN HNFOPefAki9QcrNI6V/nKt2w7Mg9u/k50vNuyQpJGKBK0Qbq+8DOeiMeFdTjh8LpwvPQ xPsg9NroqhgiWAEx4/a4eYgFBe8gj3Z4t7J5K/GNsYyCMz6DfUqFLjBfix+nMvJ/0tAV IEHA== 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:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bMT7iFyTAOueHgEVSqDZ8kKdm4uU+X+OUXiV+KzwJN4=; b=00Ls2jIBdDBA0CfLg19DY8PYWt4sMKcat8hYDSkDonsF62rvxyeLTMqazvFUvTG1Tu rjbXk6P1J5QxGGwKVrQg28yHpAOUdpUFr1CCmPgSzdPhWD8yZSj1S8BMu7rtpXNNLJ2b OaCWfN4zq2hjY3sLy2uXpvusOG75Oyy2d9JFZ/1Z+hQF6pbXfk7b0LF9zLiFP60Nqevu x1CZ3fSadTG3GdCGwnxto9VtwCEDqcDsoaUtj4fAiCVpTOob4zDQlMPHGSV77ip2S1q/ UizKTE9sNyOIBLBKZvUNrGUDw/yD0GdMMc1EOykvpEmBkLUXb82kiH4zKAfzNBJLb1f5 eqQw== X-Gm-Message-State: AOAM531YoNk3cJDGYbMIR0AejCaFWR/mQAJLT0C77kMkbq2A9gj9o4vz 5FkK9pLYmy/FGTvxSaIWzw6rtO7RdLs= X-Google-Smtp-Source: ABdhPJxtaF6yQSJm0V07LdOmPrUA7zFffUI6UnSeOKfZO8NqsWwp4V+ntlTGRizswsPsTmghMg1IMg== X-Received: by 2002:adf:d4c7:: with SMTP id w7mr6054149wrk.606.1641959042557; Tue, 11 Jan 2022 19:44:02 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id a3sm12083038wri.89.2022.01.11.19.44.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jan 2022 19:44:01 -0800 (PST) In-Reply-To: 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:284635 Archived-At: Hi! On 11.01.2022 09: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: > or > > - Mark the symbol you wish to replace > - Save symbol to kill ring with 'kill-ring-save' You don't need these two steps, do you? Just do the rest, and it should work. > - 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 I agree it could use some more optimization still. > '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. If we're trying to improve project-query-replace-regexp, why not make it use the symbol at point by default? You would use the same command, but would be able to press RET to have the default regexp (symbol at point) used as FROM. I don't have a patch yet, but it might be something that all callers of query-replace-read-args might benefit from. And you can actually do this right now: - Enter command 'project-query-replace-regexp' - Press M-n, having the symbol at point picked up as FROM, hit return - Enter the replacement string and hit return