From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default Date: Thu, 04 Jun 2020 01:54:47 +0300 Organization: LINKOV.NET Message-ID: <87a71jwyiw.fsf@mail.linkov.net> References: <3705c67a-f3a1-4667-8c3f-67b41752f355@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="119722"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 41692@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 04 01:06:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jgcSb-000V2Y-1r for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Jun 2020 01:06:13 +0200 Original-Received: from localhost ([::1]:47490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgcSa-0007f3-2g for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Jun 2020 19:06:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgcSR-0007bl-Fl for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2020 19:06:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgcSR-0006c3-5v for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2020 19:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgcSR-0005AK-1J for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2020 19:06:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jun 2020 23:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41692 X-GNU-PR-Package: emacs Original-Received: via spool by 41692-submit@debbugs.gnu.org id=B41692.159122555119813 (code B ref 41692); Wed, 03 Jun 2020 23:06:02 +0000 Original-Received: (at 41692) by debbugs.gnu.org; 3 Jun 2020 23:05:51 +0000 Original-Received: from localhost ([127.0.0.1]:44716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgcSF-00059U-5w for submit@debbugs.gnu.org; Wed, 03 Jun 2020 19:05:51 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:58467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgcSC-000591-Cp for 41692@debbugs.gnu.org; Wed, 03 Jun 2020 19:05:49 -0400 X-Originating-IP: 91.129.108.6 Original-Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B5E31C0007; Wed, 3 Jun 2020 23:05:41 +0000 (UTC) In-Reply-To: <3705c67a-f3a1-4667-8c3f-67b41752f355@default> (Drew Adams's message of "Wed, 3 Jun 2020 11:35:41 -0700 (PDT)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181484 Archived-At: > If you want to default the FROM or TO text for `query-replace' to some > text at point, you currently need to first isearch for it. This request > is essentially to be able to skip doing that. > > As an example (only), in my own code, my version of > `query-replace-read-from' can get the default any of these ways: > > * Text of nonempty active region, if option > `search/replace-region-as-default-flag' is non-nil. > > * Text of secondary selection, if option > `search/replace-2nd-sel-as-default-flag' is non-nil. > > * What the (function) value of option `search/replace-default-fn' > returns, when called. This defaults to a function that grabs text at > point. (If the function returns a list of strings, then those are the > multiple default values.) > > (As with vanilla query-replace, you can also use the history lists, > and you can enter nothing to repeat the previous query replacement > operation.) > > I don't say that vanilla Emacs should do all of that. But maybe at > least something like the third one - a function that returns a string or > list of strings to be used as default values, and with, as its default > value, a function that grabs some text at point. query-replace-regexp already does all the above. It provides text at point for first M-n, the last search string for the second M-n, etc.