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 21:43:43 +0200 Message-ID: <699f09df-d685-ce80-7c57-a36824e7066b@yandex.ru> References: <88e2f28a-925b-551c-b85b-0af400997dc5@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38276"; 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: emacs-devel@gnu.org To: Jon Eskin , Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 12 20:47:38 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 1n7jar-0009kw-7E for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Jan 2022 20:47:37 +0100 Original-Received: from localhost ([::1]:42398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7jap-0006kT-RJ for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Jan 2022 14:47:35 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7jYk-0005WC-Gv for emacs-devel@gnu.org; Wed, 12 Jan 2022 14:45:26 -0500 Original-Received: from [2a00:1450:4864:20::434] (port=40758 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7jYY-00051X-Cm for emacs-devel@gnu.org; Wed, 12 Jan 2022 14:45:17 -0500 Original-Received: by mail-wr1-x434.google.com with SMTP id x4so6141053wru.7 for ; Wed, 12 Jan 2022 11:45:13 -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=IBoYDViippkWNKOx5gED7+VuJohEv+UrNCton/Q4hbI=; b=m15vg1qizNmz7F5hxoP7KDfHeFUIaMGWZfr1yNVpovMjCSBzsnMxGHqyXAAmfWY9XJ mIVLvUi+tRUn3FYGn2JB498dja4GiKFkDvBFCkkKRuNF78xPDPtT6bXck2ipwHr1Zb2l iKgOOgUqjH87u/3bAHojp/zsVGxjxVFx2UOD3nL8QwqUCwVGgLyFSlOZ+xyxaaBlEuCR Wsb3IBN0+TRDWKgF8QnpVBxjiCb0Ow88osJeb/xPeoThnVOlWALuDbelPJUCxI42QoGm 5ekZUTEl1UcMwMTfu/lXXN6by6w2vZJ7oGkE4yStzH9AWspUW2D7T3b4Egq+gEkNgQLk AfKQ== 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=IBoYDViippkWNKOx5gED7+VuJohEv+UrNCton/Q4hbI=; b=3gCSdOpoq0mCXe9c1/KJBOz0KSPHR3vKvvg1COVQ9j0aIrlTwI6A4Yop5bgpC60Xca Gy4kKzONLk4SgQIZvtHxqSMZAhFKCUxK+bxTHbeO97obvBVKoyTnawliKpWm1sQPtlIp KZeKn0evBrT6kW4GCpVbc25McoO4PtDBeq2cJbCiPja0QjnYehhj13IUklOjp7U2tmXg EGsVjwOne25RC917Ct6d7Rt2tEADaWxIxepcPNAAmxM66RgTP6EO2mFYZV3A5xh5jEYV n3Yu6qF/8k22xLoas3Cdndk+mdWnsTM7YUPpcy2QkXm+vB2Fajfz8iK/uIDu6ShZwVAh 9fPQ== X-Gm-Message-State: AOAM532B2LX0X8Ym/XAqpY82hxWD3RAUY6+5AQQx8NKzTCeMbXXn806x yaXLirpbs4R83GZ1Mn384XZlvK2oHaI= X-Google-Smtp-Source: ABdhPJyx0rctb0bVR2jtMMFRcXsDn8JPP7f1kaRFmCGB4VUDrF7HGt5SeLUSm3x93Hy97109Mj/R/Q== X-Received: by 2002:a5d:4b84:: with SMTP id b4mr1118764wrt.490.1642016711710; Wed, 12 Jan 2022 11:45:11 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z3sm3760813wma.12.2022.01.12.11.45.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jan 2022 11:45:11 -0800 (PST) In-Reply-To: Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=raaahh@gmail.com; helo=mail-wr1-x434.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:284664 Archived-At: On 12.01.2022 10:03, Jon Eskin wrote: >> If we're trying to improve project-query-replace-regexp, why not make >> it use the symbol at point by default? >> > > I thought about the option of using symbol at point by default, but I > noticed that the command currently uses the history variable. I wondered > if some people were relying on its current behavior in a way that I > didn’t anticipate (especially since I’m pretty new to all this). If so, > it would be an annoying change to have to worry about whether the cursor > is on a symbol when using a command you previously relied on. I wanted > to try to put forth something possibly useful without breaking stuff. > >> 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. > > Since I think I can understand what you’re suggesting, I would be happy > to make an attempt at a patch to modify the callers of > query-replace-read-args to default to a regexp quoted symbol-at-point. > But no worries if you would rather have experienced eyes on it. I'm actually not sure about the best way to implement this: whether we definitely want query-replace-read-args to use symbol-at-point as the default FROM. But it does sounds handy to me. Let's ask the developer who touched it last. Juri, what do you think? >> 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 > > This is awesome! Did not know about that behavior, thank you for sharing! That capability actually comes with the "forward history" thing. Not very obvious, but when you learn about it, it's pretty nice.