GNU bug report logs - #23484
25.1.50; undo doesn't work properly in xref-query-replace-in-results

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Dmitry Gutov <dgutov@HIDDEN>; dated Sun, 8 May 2016 19:07:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 14 May 2016 21:13:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 14 17:13:25 2016
Received: from localhost ([127.0.0.1]:51757 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b1gsH-00083M-Gt
	for submit <at> debbugs.gnu.org; Sat, 14 May 2016 17:13:25 -0400
Received: from mail-wm0-f41.google.com ([74.125.82.41]:37421)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1b1gsF-000839-9P
 for 23484 <at> debbugs.gnu.org; Sat, 14 May 2016 17:13:23 -0400
Received: by mail-wm0-f41.google.com with SMTP id a17so79886168wme.0
 for <23484 <at> debbugs.gnu.org>; Sat, 14 May 2016 14:13:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=pNEV4ngxEgSUMwxDbD/n10EXMe5syfUxeurbmC4jrnA=;
 b=yf9fvLoAbbmoWdcbfuwGF9vA44OUdJcgO/1a6MpqnBI30PR/yPP1dh3iRb1+G5+I+k
 G6iGHbOiuqn9CMZPyV8EjX0/Ch6O9Mrtjj46AkWprlZ7+MHBB2KROqkYUnk91oz4dsPE
 VJWIwh3ycP4X5Ht3ff+HvFq5qXSBTdRSuRtyO0TKOsWfbhN2/X1+N5VxVmti01AJUGJ7
 nytoGuvnyrRMZLkflba7ceQgaroz1Zwe+TPvsB4Mpmvqi3DYHLUZcqnk6mOpGxgMcKhS
 L1AqDROPvGgbX4xfmsmIsljqG1sQycU0ToRJ+x/1uT7svOiMyXTjlNrdymXg6/eRtPWc
 iAgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=pNEV4ngxEgSUMwxDbD/n10EXMe5syfUxeurbmC4jrnA=;
 b=V5flh6rsLAz06OQesJFPBieNgWwLcFdDoelNgPGKkM+5tdrKzSzCZQD/+Bgznm3JVr
 ECbS62zZruppFH5AvaWTcVPT2m/s7bxp5Wf+EXdiGu6ltN0o05xBVz91iWwieuujruSp
 Rp42yOhsgyvZK/mElH02x8M91Go4T3juawj9jqY1sC+zIl7K14cxRHFTTj5IBKlif5EP
 QGAWeAuOH+UjOP7aZXxVTbR+mz6V4i85X9wJK4iHGM4lSlDtBYJYNW67Iop9pMy/nllU
 VOAGr7kSHxn3pUGbYYOLcsW+hq+ECKLTJYiVODjciwTlTK3BSBuWiu2Vouq81N/Yn7h4
 IQDA==
X-Gm-Message-State: AOPr4FXUT5JfZkKvRq3k8lZt84Uud6eN6g/mW9SXcPmARGKlinqtZqZViqPTKJq1ps4Hmw==
X-Received: by 10.194.175.168 with SMTP id cb8mr22236326wjc.56.1463260397620; 
 Sat, 14 May 2016 14:13:17 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id
 ry15sm25434704wjb.19.2016.05.14.14.13.16
 (version=TLSv1/SSLv3 cipher=OTHER);
 Sat, 14 May 2016 14:13:16 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
 <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
 <87k2j0b9sk.fsf@HIDDEN>
 <dd110d0b-b5b2-4213-7382-8a4897409911@HIDDEN>
 <87eg97hu2s.fsf@HIDDEN>
 <783855a4-8ac2-f53c-7722-eacf530d732c@HIDDEN>
 <87shxkz7yu.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <b9945af0-5f6e-fa47-5cf2-c9ae48041fb7@HIDDEN>
Date: Sun, 15 May 2016 00:13:15 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <87shxkz7yu.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05/14/2016 11:34 PM, Juri Linkov wrote:

> By default .* tries to match whole lines.

If you have a rectangular region, shouldn't replacing .* with whatever 
only touch the parts of each line within that rectangle?

That's what region-noncontiguous-p means.

 > For partial matches you need
 > to use a combination of goto-line and BOUND arg of re-search-forward.

Either you are referring to the current implementation of 
xref--query-replace-1, or I don't know what else you want me to do.

> But I still don't see a case where a search regexp used to find matches
> in the *xref* buffer can't be re-used in xref-query-replace-in-results.

I have mentioned xref-find-references several times in the recent 
messages alone. An like I said, several times, an xref backend is 
allowed to implement it with something more complex than using a plain 
regexp search.

In fact, if the current directory has a CScope or Global index 
generated, and the relevant program is installed, 
xref-collect-references *will* use something different than a regexp search.

> I tried ‘xref-find-definitions’ with a string identifier, then typed ‘r’
>
> Then I thought that maybe you meant the case of ‘xref-find-apropos’

Replacing the results of xref-find-definitions or xref-find-apropos 
would be a useless nonsense (all usages of the function(s) or 
variable(s) in question would be left intact). This is one of a few 
reasons why it isn't supported.

> It's difficult to find a solution without a real use case.

If my explanations are too complicated, can't you just take it on faith 
that the only data the replacement command can use here is a list of 
pairs of markers?

> Maybe undo could use a search function too.  And with using
> a search function should also avoid the need to disable
> query-replace-lazy-highlight in xref--query-replace-1.

Not sure how one follows from the other, but great.

> But it seems there is no hurry in fixing undo because undo of replacements
> is a new feature existing only in master, not in the release branch.

Sure. I never implied that this bug is a blocker for 25.1.

> If you are looking for a solution for the next release, I recommend
> to not expose .* in the minibuffer to the users - that causes too many
> problems.

Since one release will happen in the meantime, we'll probably hear about 
this from the users anyway. But this is orthogonal to the solution for 
the current problem.

> Either leave the initial FROM regexp empty, so the user types
> an explicit string,

So they'll always *have to* type something? This is very impractical, 
which is definitely worse than just being confusing.

> or don't ask FROM at all,

...and implicitly use `.*' as FROM.

I think I've replied to this suggestion twice already.

> using the same regexp
> provided to find matches in the *xref* buffer, thus removing all tricks
> with isearch-filter-predicate/replace-re-search-function, i.e. since the
> .* replacement is not a release-ready feature, just continue its development
> in master.

FFS, no. This is not feasible.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 14 May 2016 20:52:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 14 16:52:39 2016
Received: from localhost ([127.0.0.1]:51749 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b1gYB-0007ZC-GH
	for submit <at> debbugs.gnu.org; Sat, 14 May 2016 16:52:39 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:39048
 helo=homiemail-a19.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1b1gY9-0007Z3-Cp
 for 23484 <at> debbugs.gnu.org; Sat, 14 May 2016 16:52:37 -0400
Received: from homiemail-a19.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a19.g.dreamhost.com (Postfix) with ESMTP id CB938604069;
 Sat, 14 May 2016 13:52:34 -0700 (PDT)
Received: from localhost.linkov.net (85.253.133.157.cable.starman.ee
 [85.253.133.157]) (Authenticated sender: jurta@HIDDEN)
 by homiemail-a19.g.dreamhost.com (Postfix) with ESMTPA id ED684604061;
 Sat, 14 May 2016 13:52:33 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#23484: 25.1.50;
 undo doesn't work properly in xref-query-replace-in-results
Organization: LINKOV.NET
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
 <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
 <87k2j0b9sk.fsf@HIDDEN>
 <dd110d0b-b5b2-4213-7382-8a4897409911@HIDDEN>
 <87eg97hu2s.fsf@HIDDEN>
 <783855a4-8ac2-f53c-7722-eacf530d732c@HIDDEN>
Date: Sat, 14 May 2016 23:34:23 +0300
In-Reply-To: <783855a4-8ac2-f53c-7722-eacf530d732c@HIDDEN> (Dmitry Gutov's
 message of "Fri, 13 May 2016 01:01:53 +0300")
Message-ID: <87shxkz7yu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

>> So I see your aim is to use regexp replacements without regexps,
>> i.e. with only a list of region boundaries like is used by
>> region-noncontiguous-p in perform-replace.
>
> This may sound crazy, but shouldn't just using region-extract-function =
to
> return the list of region bounds work? FROM-STRING can then be `.*' wit=
hout
> a problem.

By default .* tries to match whole lines.  For partial matches you need
to use a combination of goto-line and BOUND arg of re-search-forward.

But I still don't see a case where a search regexp used to find matches
in the *xref* buffer can't be re-used in xref-query-replace-in-results.

I tried =E2=80=98xref-find-definitions=E2=80=99 with a string identifier,=
 then typed =E2=80=98r=E2=80=99
in the *xref* buffer - it asked =E2=80=9CXref query-replace (regexp) (def=
ault .*): =E2=80=9D,
then I typed RET and entered a replacement string, but eventually
it failed with =E2=80=9Cuser-error: No suitable matches here=E2=80=9D.

Then I thought that maybe you meant the case of =E2=80=98xref-find-apropo=
s=E2=80=99
that might find quite different strings with partial matches of
the original pattern, but its replacements fail with the same
=E2=80=9CNo suitable matches here=E2=80=9D.

It's difficult to find a solution without a real use case.

>> I guess this could be
>> achieved with more hacking in real-match-data (maybe to use a layer
>> like replace-match-data).
>
> A lot code in perform-replace is really beyond my comprehension, but wh=
y
> would the undo code muck around with replaying match data? It could jus=
t as
> well repeat the searches.

Maybe undo could use a search function too.  And with using
a search function should also avoid the need to disable
query-replace-lazy-highlight in xref--query-replace-1.

But it seems there is no hurry in fixing undo because undo of replacement=
s
is a new feature existing only in master, not in the release branch.

If you are looking for a solution for the next release, I recommend
to not expose .* in the minibuffer to the users - that causes too many
problems.  Either leave the initial FROM regexp empty, so the user types
an explicit string, or don't ask FROM at all, using the same regexp
provided to find matches in the *xref* buffer, thus removing all tricks
with isearch-filter-predicate/replace-re-search-function, i.e. since the
.* replacement is not a release-ready feature, just continue its developm=
ent
in master.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 12 May 2016 22:02:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 12 18:02:03 2016
Received: from localhost ([127.0.0.1]:49405 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b0ygF-0003m6-79
	for submit <at> debbugs.gnu.org; Thu, 12 May 2016 18:02:03 -0400
Received: from mail-wm0-f52.google.com ([74.125.82.52]:37534)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1b0ygD-0003la-Ik
 for 23484 <at> debbugs.gnu.org; Thu, 12 May 2016 18:02:01 -0400
Received: by mail-wm0-f52.google.com with SMTP id a17so815952wme.0
 for <23484 <at> debbugs.gnu.org>; Thu, 12 May 2016 15:02:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=aMHe3Yga3WAOu0B3sxf4L09nFJURKHWMCjEyXSDjM18=;
 b=cPhdov92HCOG17+3ZPFLBuuMAS/ZqaDDs0dv/1BjtVLqe5aIbgb+mAN6m9fIfqUOva
 9KLWIUrvwxpruzNX8SDfQX2X3BNbQh8+IYSJjZ84fEofgb+Xj/W+wNygd1XZsE5NxOnJ
 65Dn5ARwuMrJyGNaRMbLJktqOCyVyTMgrtaq0Zy4NCqy8TLvYFdPm+azOTiZEnIIrm+L
 WUtbnu5zqJtde6xRuivuEmEEYhZEBHfF3RDXZ5fqWi0m4XGQLOE+vwfqZD55UUkCGwvF
 Zd/hl2zF0XzuliQYwOENYB4GWIm//VLt4BzQTMuS64S2u97DA+rFazXHrmDqiY2G7QDL
 6/hw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=aMHe3Yga3WAOu0B3sxf4L09nFJURKHWMCjEyXSDjM18=;
 b=Cmr3/6ebSXgMYuBkGWZnCiFrD9lGekLL+YVrY86ZHpcKIQcgsF/qbu03IQ9LHhN37L
 iq+BCPXtVqQSeRfAu9NtbeULSjofwhjuOJ2hbFMJeEiIfXVVFXw5aVKQXBOrD4qzzdWT
 gu1QXK4gHcK745jxNW0whfTzMvfp793dvwIVJXdnk+2nP4kQPmB4FyIWsU/FZi1ZNcHJ
 86mwT8/JAf922ON6HDpKtFXGSSqda0lqplXBG80TInEjmhsGo1/4SCPbGI92EJc3gpiJ
 3pcD6Xv9Ig+n7/PTmvUOrFB95u8A9VRSRDgcpjeRPdss/7h7+3G4gK/uImC3PF/aSYM4
 rqTw==
X-Gm-Message-State: AOPr4FW7+kIXhW8pfUrIoPKPh2ewA4rjUicTDp2Kp42mSL2zlxBM/uJegeAxmAX+NRqPqA==
X-Received: by 10.194.112.233 with SMTP id it9mr13062343wjb.22.1463090515850; 
 Thu, 12 May 2016 15:01:55 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id gk4sm15333773wjd.7.2016.05.12.15.01.54
 (version=TLSv1/SSLv3 cipher=OTHER);
 Thu, 12 May 2016 15:01:54 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
 <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
 <87k2j0b9sk.fsf@HIDDEN>
 <dd110d0b-b5b2-4213-7382-8a4897409911@HIDDEN>
 <87eg97hu2s.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <783855a4-8ac2-f53c-7722-eacf530d732c@HIDDEN>
Date: Fri, 13 May 2016 01:01:53 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <87eg97hu2s.fsf@HIDDEN>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05/12/2016 11:57 PM, Juri Linkov wrote:

> So I see your aim is to use regexp replacements without regexps,
> i.e. with only a list of region boundaries like is used by
> region-noncontiguous-p in perform-replace.

This may sound crazy, but shouldn't just using region-extract-function 
to return the list of region bounds work? FROM-STRING can then be `.*' 
without a problem.

> I guess this could be
> achieved with more hacking in real-match-data (maybe to use a layer
> like replace-match-data).

A lot code in perform-replace is really beyond my comprehension, but why 
would the undo code muck around with replaying match data? It could just 
as well repeat the searches.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 12 May 2016 21:06:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 12 17:06:34 2016
Received: from localhost ([127.0.0.1]:49381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b0xoY-0002Qr-Gq
	for submit <at> debbugs.gnu.org; Thu, 12 May 2016 17:06:34 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:42301
 helo=homiemail-a21.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1b0xoX-0002Qj-8l
 for 23484 <at> debbugs.gnu.org; Thu, 12 May 2016 17:06:33 -0400
Received: from homiemail-a21.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a21.g.dreamhost.com (Postfix) with ESMTP id 4C4A5300072;
 Thu, 12 May 2016 14:06:31 -0700 (PDT)
Received: from localhost.linkov.net (85.253.58.167.cable.starman.ee
 [85.253.58.167]) (Authenticated sender: jurta@HIDDEN)
 by homiemail-a21.g.dreamhost.com (Postfix) with ESMTPA id 7B28B300061;
 Thu, 12 May 2016 14:06:30 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#23484: 25.1.50;
 undo doesn't work properly in xref-query-replace-in-results
Organization: LINKOV.NET
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
 <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
 <87k2j0b9sk.fsf@HIDDEN>
 <dd110d0b-b5b2-4213-7382-8a4897409911@HIDDEN>
Date: Thu, 12 May 2016 23:57:33 +0300
In-Reply-To: <dd110d0b-b5b2-4213-7382-8a4897409911@HIDDEN> (Dmitry Gutov's
 message of "Thu, 12 May 2016 00:11:47 +0300")
Message-ID: <87eg97hu2s.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

> However, how would you allow doing this *without* losing the ability to
> replace the matches and just the matches? That should be the
> default choice.

So I see your aim is to use regexp replacements without regexps,
i.e. with only a list of region boundaries like is used by
region-noncontiguous-p in perform-replace.  I guess this could be
achieved with more hacking in real-match-data (maybe to use a layer
like replace-match-data).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 11 May 2016 21:11:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 11 17:11:58 2016
Received: from localhost ([127.0.0.1]:47698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b0bQE-0006oW-6F
	for submit <at> debbugs.gnu.org; Wed, 11 May 2016 17:11:58 -0400
Received: from mail-wm0-f65.google.com ([74.125.82.65]:33374)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1b0bQC-0006oF-Gu
 for 23484 <at> debbugs.gnu.org; Wed, 11 May 2016 17:11:56 -0400
Received: by mail-wm0-f65.google.com with SMTP id r12so11952072wme.0
 for <23484 <at> debbugs.gnu.org>; Wed, 11 May 2016 14:11:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=2b9/YQiPkQBqcMkFI5dxQOCLOIhiW1//lID5E/0UzKE=;
 b=qR48Vy4Is2ejeU4ggYTq8ONwi0VbHXeS++4Js2JEQF4Og5ypW+yiEa75LD60iy0t1U
 xIs8QsRcEmT+TjhECLDVw6vBf+LDZASB5yPn3bjQronA4LfL4eLVCo3jFjgQvnN3bUJ3
 UONsYNbpaQLsDQYeuix8ox765/2yWkI3FLMo0raUkttfxjSD/eFFlBs0XPKbtE6XP96d
 Og30xX0HGaw/rna1vE34l65J8HADVYcGuCUb1YUmzKid1msps+QRgCvVNr6dIr29SAwg
 59sfoL73/c4uW6yN70o8gI89KSebhBWxt4J7NRIOjIJJExEEt1dy2IbHlSuzMJb8J0+a
 adLA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=2b9/YQiPkQBqcMkFI5dxQOCLOIhiW1//lID5E/0UzKE=;
 b=GgQvtdPvvd9mSlWNCNr2MBQNd9UAh6SVFc7caVTc/aIh7Kcg46z/PGttRxeHx2dT9G
 or/uKgsUxRWqjKEr4+vA4vAedMHyDB9aQ4r5kQcD4DGvRo/a1p/yIjyGtVAchjd3zyig
 TifzuNEDa/xZUwjbEKoUVdrPQsDUAH59MPp3XYfEPVK9Ni5wCJdqWkxUUVwg78aURaa0
 8oRBaaHNxuP+Wopj+yw6Uqjind0XosAxIg1kJ8jAdoesVkz50IsBy2BLERTZoFH+wR+H
 BqhnqI+YIOSstNC72XJUTtWgTb+/MR6lq/9a40zVL/MnFjYiPYF+PgyoOuP6LNGxHteV
 gHKQ==
X-Gm-Message-State: AOPr4FVOLwzGpJtim9IcW8X/ZBmgRisiGKr3ARo2rn5a1fG6DpFDLQxQUD97ewHwWXT45w==
X-Received: by 10.194.234.167 with SMTP id uf7mr5990508wjc.122.1463001110574; 
 Wed, 11 May 2016 14:11:50 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id c194sm37832686wme.9.2016.05.11.14.11.49
 (version=TLSv1/SSLv3 cipher=OTHER);
 Wed, 11 May 2016 14:11:49 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
 <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
 <87k2j0b9sk.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <dd110d0b-b5b2-4213-7382-8a4897409911@HIDDEN>
Date: Thu, 12 May 2016 00:11:47 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <87k2j0b9sk.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05/11/2016 11:48 PM, Juri Linkov wrote:

>> You're probably right. We could provide a separate command with that
>> advanced feature (or only use ask for FROM with prefix argument). We would
>> still have `.*' under the covers in the default case, though.
>
> What is the purpose of asking FROM?  If to be able to replace
> a substring of the original xref search string, then anyway it's
> inconvenient for the user to type a part of the already typed string
> again, e.g. after searching with xref for the string “abracadabra”,
> pressing ‘r’ requires typing a substring “abracadabr”, etc.

See the quote above from my previous message.

> More useful would be to prefill the original string in the minibuffer
> (here INITIAL-CONTENTS of read-from-minibuffer is justified)
> for easy editing (removing parts of the xref search string).

Again: we don't have the access to the "original string", and there 
might not have been one.

> And then why limit to only boundaries of matches?  The user sees
> a list of matching lines in the *xref* buffer.  Let's allow the users
> to replace any text within the displayed matching lines (WYSIWYG).

It's not something I've ever had an urge to do, but sure, the more 
features the better.

However, how would you allow doing this *without* losing the ability to 
replace the matches and just the matches? That should be the default choice.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 11 May 2016 20:51:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 11 16:51:43 2016
Received: from localhost ([127.0.0.1]:47685 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b0b6c-0006Gd-U7
	for submit <at> debbugs.gnu.org; Wed, 11 May 2016 16:51:43 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:39325
 helo=homiemail-a39.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1b0b6a-0006GO-GG
 for 23484 <at> debbugs.gnu.org; Wed, 11 May 2016 16:51:40 -0400
Received: from homiemail-a39.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a39.g.dreamhost.com (Postfix) with ESMTP id 4CF2315006D;
 Wed, 11 May 2016 13:51:39 -0700 (PDT)
Received: from localhost.linkov.net (85.253.169.195.cable.starman.ee
 [85.253.169.195]) (Authenticated sender: jurta@HIDDEN)
 by homiemail-a39.g.dreamhost.com (Postfix) with ESMTPA id 6C4D9150069;
 Wed, 11 May 2016 13:51:38 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#23484: 25.1.50;
 undo doesn't work properly in xref-query-replace-in-results
Organization: LINKOV.NET
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
 <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
Date: Wed, 11 May 2016 23:48:43 +0300
In-Reply-To: <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN> (Dmitry Gutov's
 message of "Wed, 11 May 2016 01:03:14 +0300")
Message-ID: <87k2j0b9sk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

>>> - Being able to replace _any_ regexp inside the matches is a feature
>>> (though maybe it's not going to be very popular).
>>
>> Honestly speaking, the =E2=80=98.*=E2=80=99 thing is quite confusing.
>
> You're probably right. We could provide a separate command with that
> advanced feature (or only use ask for FROM with prefix argument). We wo=
uld
> still have `.*' under the covers in the default case, though.

What is the purpose of asking FROM?  If to be able to replace
a substring of the original xref search string, then anyway it's
inconvenient for the user to type a part of the already typed string
again, e.g. after searching with xref for the string =E2=80=9Cabracadabra=
=E2=80=9D,
pressing =E2=80=98r=E2=80=99 requires typing a substring =E2=80=9Cabracad=
abr=E2=80=9D, etc.

More useful would be to prefill the original string in the minibuffer
(here INITIAL-CONTENTS of read-from-minibuffer is justified)
for easy editing (removing parts of the xref search string).

This will greatly simplify replacement with perform-replace.

And then why limit to only boundaries of matches?  The user sees
a list of matching lines in the *xref* buffer.  Let's allow the users
to replace any text within the displayed matching lines (WYSIWYG).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 10 May 2016 22:03:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 10 18:03:23 2016
Received: from localhost ([127.0.0.1]:46383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b0FkR-0001a0-K1
	for submit <at> debbugs.gnu.org; Tue, 10 May 2016 18:03:23 -0400
Received: from mail-wm0-f49.google.com ([74.125.82.49]:37818)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1b0FkQ-0001Zn-J2
 for 23484 <at> debbugs.gnu.org; Tue, 10 May 2016 18:03:22 -0400
Received: by mail-wm0-f49.google.com with SMTP id a17so51296728wme.0
 for <23484 <at> debbugs.gnu.org>; Tue, 10 May 2016 15:03:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=kAjVLnMqHZLwNsAa1iuElZV7XSwvnbeFCNVfq79zRdQ=;
 b=R2apF04tEwgxFV3kKRsdA+6JLyCjYREYWna+YJL3OMZpoeKNMLUpgmBnx7KMrkolCZ
 UoKm1HFd4t1lHoS45SUpSxkzAdI/0Zdq1oDzIY9bB4k1TXqYFBzAktx5M3Sxiym81P+3
 Xra7c0sYNxMDXZx6DaVKW6tSSfI3ROXIKFsBFXaz3b8fs1qIRbtEdXd628Jl+z3wSQtg
 w/7SgOnpOqBhLTNiBsFcOQXHL3YmCQXN6RQN4tVDRFW37d7tiOizNLHUCP/aPxPxtl6P
 2LJVCgKHygsvQgJi20h+zG1TAlWjZ7c8+6o9dA62UoEIeAHWgLY4najzrNAAkxsuuN6S
 6aGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=kAjVLnMqHZLwNsAa1iuElZV7XSwvnbeFCNVfq79zRdQ=;
 b=EDhoGSP2OYW7KgPIm+HAebrqWRrGJ+Y39JibuVTiRbvZzsF6hkQ0TRJgRLYRzOMZ3b
 NLv/FWtCKhXZCT8mwSu2H2lRuIfIBMlR1oqWSxXCTTCpLOD8ZV/Ntvr0JUMOV78U8HHK
 /mIscXPZWZfe+Ms5wCgFm4wQaH2wxrjCAPSfVbE2OofmDczH/Vk09tBCdHe0t9ijPJoa
 35ua/4RYlMnJ9dT/b4Oc5FFJYyOi/uxczTplq5p6JRS0lyrpfvSloic1FVrleSpIG3PW
 Wr5FNz0t+86k/Qn9I2CK5Sk/FwHzZX+o0nqgijQQOuUVeZzAnELrOOaj/nvsBxk/snSZ
 yn/w==
X-Gm-Message-State: AOPr4FW+0KSGcP7zNqj49Em8TqPE4UWWrPTrhzDkVEUJs9QpQbnr4QKnunOHXxDWXJzZXA==
X-Received: by 10.194.108.197 with SMTP id hm5mr41917273wjb.167.1462917796585; 
 Tue, 10 May 2016 15:03:16 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id u6sm32472024wmd.21.2016.05.10.15.03.15
 (version=TLSv1/SSLv3 cipher=OTHER);
 Tue, 10 May 2016 15:03:15 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
 <8737pp1tt6.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <f8f1505f-487c-a67d-0f60-1529e3e642e1@HIDDEN>
Date: Wed, 11 May 2016 01:03:14 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <8737pp1tt6.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05/11/2016 12:34 AM, Juri Linkov wrote:

>> - Being able to replace _any_ regexp inside the matches is a feature
>> (though maybe it's not going to be very popular).
>
> Honestly speaking, the ‘.*’ thing is quite confusing.

You're probably right. We could provide a separate command with that 
advanced feature (or only use ask for FROM with prefix argument). We 
would still have `.*' under the covers in the default case, though.

> More natural syntax is ‘\&’ like is used in e.g.
> ‘occur-read-primary-args’ to collect the entire match.

I'm not sure how \& would be used. And the ability to use \1, \2, etc, 
seems to depend on the original regexp. Which is a) currently unknowable 
(and the original search may have been performed not using a regexp, but 
e.g. by asking a specialized external program), b) not something the 
user can choose when the command is e.g. xref-find-references.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 10 May 2016 21:35:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 10 17:35:32 2016
Received: from localhost ([127.0.0.1]:46371 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b0FJU-0000we-09
	for submit <at> debbugs.gnu.org; Tue, 10 May 2016 17:35:32 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:53934
 helo=homiemail-a11.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1b0FJR-0000wR-3F
 for 23484 <at> debbugs.gnu.org; Tue, 10 May 2016 17:35:30 -0400
Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id 39CB16E076;
 Tue, 10 May 2016 14:35:27 -0700 (PDT)
Received: from localhost.linkov.net (82.131.112.62.cable.starman.ee
 [82.131.112.62]) (Authenticated sender: jurta@HIDDEN)
 by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPA id 5DE096E074;
 Tue, 10 May 2016 14:35:26 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#23484: 25.1.50;
 undo doesn't work properly in xref-query-replace-in-results
Organization: LINKOV.NET
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
Date: Wed, 11 May 2016 00:34:11 +0300
In-Reply-To: <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN> (Dmitry Gutov's
 message of "Mon, 9 May 2016 23:10:15 +0300")
Message-ID: <8737pp1tt6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

>> Why not using an original search string instead of =E2=80=98.*=E2=80=99=
 thus avoiding
>> tricks with isearch-filter-predicate/replace-re-search-function?
>
> A few reasons:
>
> - We don't actually save it.
> - Being able to replace _any_ regexp inside the matches is a feature
> (though maybe it's not going to be very popular).

Honestly speaking, the =E2=80=98.*=E2=80=99 thing is quite confusing.
More natural syntax is =E2=80=98\&=E2=80=99 like is used in e.g.
=E2=80=98occur-read-primary-args=E2=80=99 to collect the entire match.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 9 May 2016 20:19:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 09 16:19:45 2016
Received: from localhost ([127.0.0.1]:44733 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1azreb-0003Y2-6S
	for submit <at> debbugs.gnu.org; Mon, 09 May 2016 16:19:45 -0400
Received: from mail-wm0-f47.google.com ([74.125.82.47]:34746)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1azreY-0003Xn-E1
 for 23484 <at> debbugs.gnu.org; Mon, 09 May 2016 16:19:44 -0400
Received: by mail-wm0-f47.google.com with SMTP id v200so23451791wmv.1
 for <23484 <at> debbugs.gnu.org>; Mon, 09 May 2016 13:19:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=My65ZE8mgkq8euoMz/iRoobV5vOFtS01FghIwXes9hc=;
 b=jSiX4a561GKXvjyn8ucRobSbNzyxvCev8xtWrGuVkaZAyMbnSbTW6IeHYknLiCJHnp
 KQompPmroCXeLiiG7u1TZhV14EkbWlRq83gVI7BCz5fSZ0kAXwpIkxD0fhcd/pF7pJba
 LzbaKEdrv0s7FzLpF4FM2ZBptMNLyJBmct3tAEpOiLrZwFPGaPY1hUS2ltX/0XGGsmOh
 y5lSO9N3N75vAwIpceeLHUaQCJTqKdZIzO9Su4iY8dlhzPOH9ZtqEHWSHouDA/OLp5IO
 W0r6d+6z4fblAhwet1VHTcPEaPws93cHWsEgQxHlEIHjlLijCPNxoS5TfDvQUeNSyjYI
 u0pw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=My65ZE8mgkq8euoMz/iRoobV5vOFtS01FghIwXes9hc=;
 b=Do38JnRa14e9FfR+wFjLDnyh0lIKF+KaLK43dADnYBRu+xcaGhtgpmybmeUe0tCT5l
 zmbUR4kzhTPZrxrgxR/7iS44D6SbA+jTs/RQz8+mlWmito7Qzojdqm/qaxyY2cl3EXao
 q/EZhVmfTGH7FP9OK8f3cshTTS97QrXhDb5Fd2SvoJ47yzIZ3y62nkH6EMVYkR0uKKEv
 nYpmumDAaaIooMMhatqVKJCAsaYLrucltjxWIa++SoPkfHHNZNU/bZmbkc98fhmu5b2d
 Rvc6J6csJE+s+mCyVyz91ppWOU0neBPgLbsmeljyYKBbLBrvD7pwCRCmg8oj+o2s9lMG
 hEjQ==
X-Gm-Message-State: AOPr4FVwO2eyKEWSqXAw1fy3XrmBevGwk2i1+Z7RCud+cZLyXy3adTKRTN9l9wk6bZBDfA==
X-Received: by 10.194.75.197 with SMTP id e5mr31919436wjw.154.1462825174757;
 Mon, 09 May 2016 13:19:34 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id pm4sm32944045wjb.35.2016.05.09.13.19.33
 (version=TLSv1/SSLv3 cipher=OTHER);
 Mon, 09 May 2016 13:19:34 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
 <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <db28dfd8-b816-37d5-9b58-3cf266817a70@HIDDEN>
Date: Mon, 9 May 2016 23:19:32 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

Sorry,

> That's not true, xref is not limited by Grep is regexp searching in the
                                                ^^ or
> ways that its results are found.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 9 May 2016 20:10:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 09 16:10:26 2016
Received: from localhost ([127.0.0.1]:44729 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1azrVa-0003Kj-6Y
	for submit <at> debbugs.gnu.org; Mon, 09 May 2016 16:10:26 -0400
Received: from mail-wm0-f41.google.com ([74.125.82.41]:37370)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1azrVY-0003KT-4J
 for 23484 <at> debbugs.gnu.org; Mon, 09 May 2016 16:10:24 -0400
Received: by mail-wm0-f41.google.com with SMTP id a17so206255954wme.0
 for <23484 <at> debbugs.gnu.org>; Mon, 09 May 2016 13:10:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=vs+gisCgEG8shRAb3z5IMApXpXhZQ6ZWZGHBlYzwr1M=;
 b=M+vfTS+SlQN2GMYai/0zxep0MqWv/NA92tFNy5nQVNZJb3/F5whi35AtGveqSvc8Wg
 jDqSgz4QB+Mu/wUWCwLqG7Az8NI92Ei0+1u0gdbq4uE9bc1kBqMFUt74zTibGlVRzE6l
 BcsBWlD8AvWTtIi3NK6W1VlTtSYBqxkmZTo4ey2PVZwhQ7QDpRuZCsPI0OTFhzPEi1Rl
 XE/TSqM2suXVZJ++OO6HRGSo6WzBsEKAkRyTofIn9QKvRfYsfYbm5nCveD2nqMBwVZ4A
 j6nEZtKuyRMTkXCiOf5eJmkgmPL2aw/xPJ8mQ5AIXfDpa+3xfFEbVVxYWJYvHdCD8HdG
 2FZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=vs+gisCgEG8shRAb3z5IMApXpXhZQ6ZWZGHBlYzwr1M=;
 b=C+hbOGMkGh7fCQdHmXgZQfzU6KKE3IY/nETekBYk5HvkIbEBjsApptOz9x+/OCnlmP
 KV/vrPhkuby3iinECQuJbGObXO5vFS1Mc8C1HSPdG3/2fcEYwA3B6b1cVmc7kgNw2sSx
 n2ayZ++0OIE9TOpa1X7P1IBVCqvan7b5N96S12fI4NX7bUqZUdf1I91Fg07IMRbLyFUa
 9NxC41V9iwly87Ed75+/uzmm/KAUEmFkfdLKOZeouyAydxQ6uzlBTbPw5vx+kZ50NUXJ
 xztpWzGUM4qEsFF8PR33OuzjonwUkFRFFwg0wS0hwq1HwWrFfkBzYI4nGeENhkP+fZm/
 XZcg==
X-Gm-Message-State: AOPr4FXcxmlX+ShCAzSvlsmA6UniQGey9Cet3SGZXRrcponEEW59bKVyah3HNNfP4qbKiw==
X-Received: by 10.28.139.137 with SMTP id n131mr12636690wmd.13.1462824617832; 
 Mon, 09 May 2016 13:10:17 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id vu4sm32864974wjc.27.2016.05.09.13.10.16
 (version=TLSv1/SSLv3 cipher=OTHER);
 Mon, 09 May 2016 13:10:17 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
 <8760unxaoi.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <118c4316-9179-c9dd-e7d1-97b96921d922@HIDDEN>
Date: Mon, 9 May 2016 23:10:15 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <8760unxaoi.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05/09/2016 11:01 PM, Juri Linkov wrote:

> Why not using an original search string instead of ‘.*’ thus avoiding
> tricks with isearch-filter-predicate/replace-re-search-function?

A few reasons:

- We don't actually save it.
- Being able to replace _any_ regexp inside the matches is a feature 
(though maybe it's not going to be very popular).
- We're replacing the given list of matches, not all regexp occurrences.

> perform-replace will have no problem finding the same matches
> as found by xref.

That's not true, xref is not limited by Grep is regexp searching in the 
ways that its results are found.

E.g. xref-find-references is not necessarily the result of a regexp 
search. The default implementation is a bit basic, but different 
backends can implement smarter logic (so that the search takes into 
account the context at point, and only returns the uses of the local 
variable within its scope, or only method calls, etc). We'll still want 
to be able to replace them.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 9 May 2016 20:02:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 09 16:02:57 2016
Received: from localhost ([127.0.0.1]:44725 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1azrOL-00039Z-Ek
	for submit <at> debbugs.gnu.org; Mon, 09 May 2016 16:02:57 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:38679
 helo=homiemail-a76.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1azrOG-00039O-Ra
 for 23484 <at> debbugs.gnu.org; Mon, 09 May 2016 16:02:55 -0400
Received: from homiemail-a76.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a76.g.dreamhost.com (Postfix) with ESMTP id C8BDF45807B;
 Mon,  9 May 2016 13:02:51 -0700 (PDT)
Received: from localhost.linkov.net (62.65.224.13.cable.starman.ee
 [62.65.224.13]) (Authenticated sender: jurta@HIDDEN)
 by homiemail-a76.g.dreamhost.com (Postfix) with ESMTPA id 0C536458079;
 Mon,  9 May 2016 13:02:50 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#23484: 25.1.50;
 undo doesn't work properly in xref-query-replace-in-results
Organization: LINKOV.NET
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
 <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
Date: Mon, 09 May 2016 23:01:49 +0300
In-Reply-To: <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN> (Dmitry Gutov's
 message of "Sun, 8 May 2016 23:26:19 +0300")
Message-ID: <8760unxaoi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

>> Then maybe there is a better way to achieve the same.
>
> Maybe there is, but I don't know it.
>
>> You don't need isearch-filter-predicate when doing undo
>> because a previous replacement already checked it, no?
>
> Not sure. It's possible the problem is caused by FROM being `.*'. The
> post-undo code initiates new searches at the positions of the previous
> matches using `looking-at'.

Why not using an original search string instead of =E2=80=98.*=E2=80=99 t=
hus avoiding
tricks with isearch-filter-predicate/replace-re-search-function?

perform-replace will have no problem finding the same matches
as found by xref.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 8 May 2016 20:26:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 08 16:26:28 2016
Received: from localhost ([127.0.0.1]:43534 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1azVHY-0004DK-3d
	for submit <at> debbugs.gnu.org; Sun, 08 May 2016 16:26:28 -0400
Received: from mail-wm0-f42.google.com ([74.125.82.42]:38245)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1azVHX-0004D8-4g
 for 23484 <at> debbugs.gnu.org; Sun, 08 May 2016 16:26:27 -0400
Received: by mail-wm0-f42.google.com with SMTP id g17so155416667wme.1
 for <23484 <at> debbugs.gnu.org>; Sun, 08 May 2016 13:26:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding;
 bh=nUynnEEa3rxtec2fyiCsK/7A46pcWKsgq3/j658O+fs=;
 b=ef4qsC8vxiZrbDH9FhCIy8sBveNaviPa3mE9lxlXx/hffNnfg+LQFVnrIjp5KsupjT
 m3QLz+ssDl75vzP3yRdhX7fYGN+AuIa2WhR4YpSQER3MCvMHFLFP8sknsTIb0syvUnbQ
 XqtTk7Zi3meruvDxytlqnkrzCSrK14Q5vQleoaFRocuMXX+OXXOkWQxYFznYJ4ZpOq8N
 4wPNv9H0Wq+SgnX5g1pxsKfLxBHIMInyGmxyviUdXuNs2G/w/+yYD4mGhyaef1su0oXd
 wykTR/v/ilMG1ZSLEcTakoGRSdd/BkHIs5H6QkC9+fU/fUjD3sYsZCwU6bgIEHE0BceX
 OHZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:subject:to:references:cc:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=nUynnEEa3rxtec2fyiCsK/7A46pcWKsgq3/j658O+fs=;
 b=nLxVaI7svTw07Iu5D3lhFxKQt6MbXN3wsYOv2I5+Z18aogWYY8FnYUrwvxEjhcODQi
 7QlKNRa9KV/wgLLqFnSn+9owt99PBjDxINysl6hJJA0dV2Wj4iZ4xYC0nD/yegxhqF01
 Sr6hknbWt/Z85VJk/qrfQDM6ran8TN3FDcaJIw8Z0g8N5WarsTyrp4s0qZb637zTkgxh
 Oeeux9q7dH0hHM3A70kCneelp0+yScKyYRbHhXoJjyQB0VOmVGNLAXIKStXNu94uSvec
 3tZqeaRWGXLw/eu+P9fnjlq7Ey4XhUMHIuU6Ijj89bIw42W/Rc6/wPFVhtIwFKMuAAZz
 Z2iQ==
X-Gm-Message-State: AOPr4FW0AkOj5uZk1PGRdYk52EgKB5AoZ9URwEUMnu+ie3sIjHn7m4+5nIqKAIdpFaKNZA==
X-Received: by 10.28.165.216 with SMTP id o207mr7199735wme.31.1462739181433;
 Sun, 08 May 2016 13:26:21 -0700 (PDT)
Received: from [192.168.1.2] ([185.105.175.24])
 by smtp.googlemail.com with ESMTPSA id m20sm20596095wma.23.2016.05.08.13.26.19
 (version=TLSv1/SSLv3 cipher=OTHER);
 Sun, 08 May 2016 13:26:20 -0700 (PDT)
Subject: Re: bug#23484: 25.1.50; undo doesn't work properly in
 xref-query-replace-in-results
To: Juri Linkov <juri@HIDDEN>
References: <86d1owl682.fsf@HIDDEN> <87inyoxpz8.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <c40255e3-2dd2-df4c-57e0-c072657a8565@HIDDEN>
Date: Sun, 8 May 2016 23:26:19 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.1
MIME-Version: 1.0
In-Reply-To: <87inyoxpz8.fsf@HIDDEN>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05/08/2016 11:19 PM, Juri Linkov wrote:

> I can't reproduce this when using normal query-replace.

Correct.

> Is this caused by binding local variables in xref--query-replace-1?

No, it's caused by perform-replace not using the said variables in a 
consistent fashion.

 > Then maybe there is a better way to achieve the same.

Maybe there is, but I don't know it.

> You don't need isearch-filter-predicate when doing undo
> because a previous replacement already checked it, no?

Not sure. It's possible the problem is caused by FROM being `.*'. The 
post-undo code initiates new searches at the positions of the previous 
matches using `looking-at'.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at 23484 <at> debbugs.gnu.org:


Received: (at 23484) by debbugs.gnu.org; 8 May 2016 20:20:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 08 16:20:54 2016
Received: from localhost ([127.0.0.1]:43530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1azVCA-000459-DE
	for submit <at> debbugs.gnu.org; Sun, 08 May 2016 16:20:54 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:52316
 helo=homiemail-a76.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1azVC7-000451-Vi
 for 23484 <at> debbugs.gnu.org; Sun, 08 May 2016 16:20:52 -0400
Received: from homiemail-a76.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a76.g.dreamhost.com (Postfix) with ESMTP id F170E45807C;
 Sun,  8 May 2016 13:20:50 -0700 (PDT)
Received: from localhost.linkov.net (85.253.58.148.cable.starman.ee
 [85.253.58.148]) (Authenticated sender: jurta@HIDDEN)
 by homiemail-a76.g.dreamhost.com (Postfix) with ESMTPA id 205F145807B;
 Sun,  8 May 2016 13:20:49 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#23484: 25.1.50;
 undo doesn't work properly in xref-query-replace-in-results
Organization: LINKOV.NET
References: <86d1owl682.fsf@HIDDEN>
Date: Sun, 08 May 2016 23:19:07 +0300
In-Reply-To: <86d1owl682.fsf@HIDDEN> (Dmitry Gutov's message of "Sun, 08
 May 2016 22:06:37 +0300")
Message-ID: <87inyoxpz8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 23484
Cc: 23484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

> 1. Do a search that has several matches in one buffer, e.g. using
> dired-do-find-regexp.
> 2. Press `r' in the *xref* buffer, to initiate replacement.  Input `.*'
> and `abcd', for instance.  This value of FROM is important.
> 3. Replace a couple then undo that (press y, y, u, u).
> 4. Try agreeing with the subsequent prompts.  The replacements performed
> then will be wrong.
>
> I've tried to come up with a patch but stopped short of really delving
> into the code of perform-replace. Which seems really necessary at this
> point. Attaching what I already have.

I can't reproduce this when using normal query-replace.
Is this caused by binding local variables in xref--query-replace-1?
Then maybe there is a better way to achieve the same.

> The big problem is that perform-replace does not consistently use
> replace-re-search-function. With the new undo code, it's became worse.
> After you press `u', it seems to switch to moving around the saved match
> data stack and using a plain looking-at, without checking with
> isearch-filter-predicate.

You don't need isearch-filter-predicate when doing undo
because a previous replacement already checked it, no?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 May 2016 19:06:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 08 15:06:55 2016
Received: from localhost ([127.0.0.1]:43468 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1azU2Y-0007Rc-Rs
	for submit <at> debbugs.gnu.org; Sun, 08 May 2016 15:06:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53118)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1azU2W-0007RN-Qu
 for submit <at> debbugs.gnu.org; Sun, 08 May 2016 15:06:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1azU2Q-0008SE-3Z
 for submit <at> debbugs.gnu.org; Sun, 08 May 2016 15:06:47 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:45978)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1azU2Q-0008S8-0a
 for submit <at> debbugs.gnu.org; Sun, 08 May 2016 15:06:46 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44045)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1azU2O-000660-Ed
 for bug-gnu-emacs@HIDDEN; Sun, 08 May 2016 15:06:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1azU2K-0008Qb-Uf
 for bug-gnu-emacs@HIDDEN; Sun, 08 May 2016 15:06:44 -0400
Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:34766)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1azU2K-0008QH-Kg
 for bug-gnu-emacs@HIDDEN; Sun, 08 May 2016 15:06:40 -0400
Received: by mail-wm0-x22d.google.com with SMTP id v200so17419591wmv.1
 for <bug-gnu-emacs@HIDDEN>; Sun, 08 May 2016 12:06:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:subject:date:message-id:mime-version;
 bh=+NGjFnMEGj4b3t/uleMsFzH6rK9z9g7PM7XCkxFUMiU=;
 b=gesyhHngFAmhxxVKigxLfeDqajp1B8cjTRqdVgcDn4bBpJp2xWMRUBSvjyCyhA1gPZ
 CDOuPsqEoXOIIIExMJZaCnaXHJ6XAnfm0+FC6qckrLK7TcAQsTS9cER+P4famdVFTbcn
 4g7zVQqAAHg4bYDalOOztJSFDpTL8UVtikbGw1jVZd3DTKVt1u30sJ+HT3Bzo4K3c3N+
 d6cOs1Tg7PHRs3mqeKzXeuJnbGj96g4qyL4SRoHDqdTQBmPKLg7gAN4Jmsp9G0ENtdoa
 SFlBdB+OU6j8FupqBb7BiVEwmhgyMBBz8ppP7ImBlUEy3nkeEgc1zJEb+AtrgB57uDU+
 A2bg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:from:to:subject:date:message-id
 :mime-version;
 bh=+NGjFnMEGj4b3t/uleMsFzH6rK9z9g7PM7XCkxFUMiU=;
 b=UOIhjWY5+2HWRkSnPzYJSqS5jJwJoNGGXjFEXDaNMXSYKGStnJ5BEJZstlivKJ+i1o
 TJA5vOc58LEaQhWE5fi8uC+26j4qh4GP2bRS3lAzIjaov94PtdbWucqEEOh+G1K6BZ92
 CV3KKl0MMFgsq188fhbOgmlrfj+lTlPq/1LY1sCdd9u/N0kOTQdTTtu4Yps4TMsOCuws
 A4YJy7y0a5DRnrCogpznb9dQLCIJUGLwOwbvfNdIwOJ6Vx/6AxqUMsORs38QlE51ILfF
 hGuHjvEwbd2GL6O7mzYcluAPXN7OKboiDnfYParl+PgAPrchmQIRpJgg3uyZYwIkKe2E
 hDJg==
X-Gm-Message-State: AOPr4FUHBDrLO7aQKBFWiMszziCFRQzFNp1ls3XrvhQGFVHB+vttYkRM6Bf1IW5soqeMXw==
X-Received: by 10.28.156.86 with SMTP id f83mr6964126wme.45.1462734399787;
 Sun, 08 May 2016 12:06:39 -0700 (PDT)
Received: from axl ([185.105.175.24])
 by smtp.gmail.com with ESMTPSA id az2sm26904594wjc.6.2016.05.08.12.06.38
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 08 May 2016 12:06:39 -0700 (PDT)
From: Dmitry Gutov <dgutov@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 25.1.50; undo doesn't work properly in xref-query-replace-in-results
Date: Sun, 08 May 2016 22:06:37 +0300
Message-ID: <86d1owl682.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.8 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.8 (---)

--=-=-=
Content-Type: text/plain

1. Do a search that has several matches in one buffer, e.g. using
dired-do-find-regexp.
2. Press `r' in the *xref* buffer, to initiate replacement.  Input `.*'
and `abcd', for instance.  This value of FROM is important.
3. Replace a couple then undo that (press y, y, u, u).
4. Try agreeing with the subsequent prompts.  The replacements performed
then will be wrong.

I've tried to come up with a patch but stopped short of really delving
into the code of perform-replace. Which seems really necessary at this
point. Attaching what I already have.

The big problem is that perform-replace does not consistently use
replace-re-search-function. With the new undo code, it's became worse.
After you press `u', it seems to switch to moving around the saved match
data stack and using a plain looking-at, without checking with
isearch-filter-predicate.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=xref-undo-fix-attempt.diff

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index f651dc9..5686cc9 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -552,6 +552,7 @@ xref--buf-pairs-iterator
                       (end (move-marker (make-marker)
                                         (+ beg (xref-match-length item))
                                         (marker-buffer beg))))
+                 (set-marker-insertion-type end t)
                  (let ((pair (cons beg end)))
                    (push pair all-pairs)
                    ;; Perform sanity check first.
@@ -593,7 +594,7 @@ xref--outdated-p
 (defun xref--query-replace-1 (from to iter)
   (let* ((query-replace-lazy-highlight nil)
          (continue t)
-         did-it-once buf-pairs pairs
+         did-it-once buf-pairs
          current-beg current-end
          ;; Counteract the "do the next match now" hack in
          ;; `perform-replace'.  And still, it'll report that those
@@ -605,23 +606,24 @@ xref--query-replace-1
                  (<= end current-end))))
          (replace-re-search-function
           (lambda (from &optional _bound noerror)
-            (let (found pair)
-              (while (and (not found) pairs)
-                (setq pair (pop pairs)
-                      current-beg (car pair)
-                      current-end (cdr pair))
-                (goto-char current-beg)
-                (when (re-search-forward from current-end noerror)
-                  (setq found t)))
-              found))))
+            (let ((tmp-pairs (cdr buf-pairs)) pair)
+              (while (and (not pair) tmp-pairs)
+                (setq current-beg (caar tmp-pairs)
+                      current-end (cdar tmp-pairs))
+                (unless (< current-beg (point))
+                  (goto-char current-beg)
+                  (when (re-search-forward from current-end noerror)
+                    (setq pair (car tmp-pairs))))
+                (setq tmp-pairs (cdr tmp-pairs)))
+              pair))))
     (while (and continue (setq buf-pairs (funcall iter :next)))
       (if did-it-once
           ;; Reuse the same window for subsequent buffers.
           (switch-to-buffer (car buf-pairs))
         (xref--with-dedicated-window
-         (pop-to-buffer (car buf-pairs)))
+         (pop-to-buffer (car buf-pairs))
+         (goto-char (point-min)))
         (setq did-it-once t))
-      (setq pairs (cdr buf-pairs))
       (setq continue
             (perform-replace from to t t nil nil multi-query-replace-map)))
     (unless did-it-once (user-error "No suitable matches here"))))

--=-=-=
Content-Type: text/plain


In GNU Emacs 25.1.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-05-08 built on axl
Repository revision: 2eb6817ba971184cc109f8530f4b3b38f65650ea
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:	Ubuntu 16.04 LTS

--=-=-=--




Acknowledgement sent to Dmitry Gutov <dgutov@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#23484; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.