GNU bug report logs - #48009
28.0.50; Support query-regexp-replace using re-builder

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; Severity: wishlist; Reported by: Phil Sainty <psainty@HIDDEN>; dated Sun, 25 Apr 2021 03:37:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 48009) by debbugs.gnu.org; 26 Apr 2021 23:54:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 26 19:54:04 2021
Received: from localhost ([127.0.0.1]:47507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lbB3E-0006DJ-3N
	for submit <at> debbugs.gnu.org; Mon, 26 Apr 2021 19:54:04 -0400
Received: from mail-pj1-f49.google.com ([209.85.216.49]:33461)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <homeros.misasa@HIDDEN>) id 1lbB3C-0006Cc-Cq
 for 48009 <at> debbugs.gnu.org; Mon, 26 Apr 2021 19:54:02 -0400
Received: by mail-pj1-f49.google.com with SMTP id
 kb13-20020a17090ae7cdb02901503d67f0beso413154pjb.0
 for <48009 <at> debbugs.gnu.org>; Mon, 26 Apr 2021 16:54:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:references:date:in-reply-to:message-id:user-agent
 :mime-version; bh=cBFyfnQ3U11DwXT0cEdL7+ihmcZDtOiIOa67iaKGf9w=;
 b=aBSZwlvncFhZak9MJuw8vfe6YzaeXxm0O5G8Dplgwuwt2NbNRvUX996G+8VdvMpxLJ
 OhaZUeEWVGkFDikbic4qBERTAyzXLiYZNZ480N6Wm3PEGekr+tPPg6rUF8KQArEaWoNU
 jzF9BQMyb1AMYG/l0Kg3aXFcUWeTAoVekjUWAi7AQfPmNO7oRi6N6G/LnLvrAJiOCxG2
 EYWknKbZU18jwCYP2tIfzijaXjey9Wxypm7iysbLdA56sMu/imENZZVVXSqhwjEEzRIr
 +e2M4R28n34MFyypgYxHq2GmHWoiKwW9F/SuScGUFOvDB4VbCVQle+YaS2vfeu4xxqSJ
 gzeQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=cBFyfnQ3U11DwXT0cEdL7+ihmcZDtOiIOa67iaKGf9w=;
 b=NX/G1OddjiXud5dcL3dLd0/UGbmIDuN/0+gNMx6iaUZlQCQEnjCLw7YQbFYYsVaaP4
 XA5785oBo4nHrxiD2lAQj0KduzFs+TS3DKrxSPfrOdZzfd/tR/qWuxR5qDopn5YvOKzk
 ylf/Mi+QPsWYPWF5O3upYUFTSvlBe9rkJWw23BEpHWW7NseeNqn/laclQIkayfEhI6vo
 dR2DsLmoBn9cKwTUllMeFJA9e839wL393DKFB9WKeKY4/FnZ4/Hv1xHnp8wkeRKdzIGp
 N1ule5dMKYzA9AJrlZYqk5jE8LkGrJvMcWrK2DJW8AafTFQLhpqQ3qBvbHYVp9x/uqKF
 gVuw==
X-Gm-Message-State: AOAM533aXGC+MKW68dlFL6URxM5pnqYs5kYJdF12lz6S9T3oZC0Bmn7S
 vTM4Z6bXi/1Yqw9mvoEabV1+Ha9LyLc=
X-Google-Smtp-Source: ABdhPJwLmnBQ3ZcnFlkdEuk/5gegwQzvn9AwK6BeJWB2E3Mk1mXsgCWiliJjulCQCXskji5BzII2XA==
X-Received: by 2002:a17:902:e851:b029:eb:1fd0:fa8e with SMTP id
 t17-20020a170902e851b02900eb1fd0fa8emr21779788plg.38.1619481235564; 
 Mon, 26 Apr 2021 16:53:55 -0700 (PDT)
Received: from DreamMini2019.local (vesta.misasa.okayama-u.ac.jp.
 [150.46.48.154])
 by smtp.gmail.com with ESMTPSA id w17sm659674pfq.187.2021.04.26.16.53.54
 for <48009 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 26 Apr 2021 16:53:55 -0700 (PDT)
From: Tak Kunihiro <homeros.misasa@HIDDEN>
X-Google-Original-From: Tak Kunihiro <tkk@HIDDEN>
To: 48009 <at> debbugs.gnu.org
Subject: Re: bug#48009: 28.0.50; Support query-regexp-replace using re-builder
References: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN>
Date: Tue, 27 Apr 2021 08:53:52 +0900
In-Reply-To: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN> (Phil
 Sainty's message of "Sun, 25 Apr 2021 15:36:07 +1200")
Message-ID: <m1zgxkeh67.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (darwin)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 48009
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: -1.0 (-)

> It would be nice to be able to use `re-builder' to interactively
> craft a regexp to pass to `query-replace-regexp' in a streamlined
> manner.

I think it is a good idea. Also pass to isearch-forward-regexp
or vr/query-replace is handy too.




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

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


Received: (at 48009) by debbugs.gnu.org; 25 Apr 2021 15:19:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 25 11:19:12 2021
Received: from localhost ([127.0.0.1]:43395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lagXP-0005Qc-VI
	for submit <at> debbugs.gnu.org; Sun, 25 Apr 2021 11:19:12 -0400
Received: from mail-pj1-f45.google.com ([209.85.216.45]:43954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1lagXO-0005QM-HI
 for 48009 <at> debbugs.gnu.org; Sun, 25 Apr 2021 11:19:11 -0400
Received: by mail-pj1-f45.google.com with SMTP id
 f6-20020a17090a6546b029015088cf4a1eso3833014pjs.2
 for <48009 <at> debbugs.gnu.org>; Sun, 25 Apr 2021 08:19:10 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:in-reply-to:references:mime-version:date
 :message-id:subject:to:cc;
 bh=dgIAgtQ7sDFcMUkmgekgreAmeGfyexwjWM8YSAjfRmk=;
 b=b0ICYuJn7JZStFJ7mpb+WRZliHnKmfGu7jy5vcmLRl52dGPHRlRl4u7DcKqlRIH5M/
 t9VgNViu3Tfi3kX28nTKWaA2qGIUzK9H5ZfYiTyI6mYvYfn1SRmxQe4RO5czpa7rwShQ
 fYfxUEzBEWE00neHpyLiV70kg4lRpZyVvTu4kxLw1ej3XAeeHzI2yHvaD7sOp9MM8l0K
 7hFAqc3PHhSLRPrBzNakf8pT7atUhiobUipw+3wmM2XrYjdcriVj9+4ZlI3OoODw3dSM
 qoia/oKcZn1no5GrGLfmrjhkBvEbd/R/ofMug2YCsqHpIQ9QZNtI5oJeMefr8OZNVFJr
 J6cA==
X-Gm-Message-State: AOAM531TAew7oAxgKavyow8CbvX6FC+CUSR2vxH8uZU6gi2/5ILYpr9p
 rYFlvHvr3YZx171AfVieTUIC6CS76ImaWeXGKdA=
X-Google-Smtp-Source: ABdhPJxke3K/IIxKTqJyG6N6yhvB8Fa2hW5SqZh8RqptQKKPE7fzO9By1Zxc3uNMoih15Y3D1ejXpddnzhHM6iCTjm0=
X-Received: by 2002:a17:90a:670b:: with SMTP id
 n11mr16102451pjj.104.1619363944864; 
 Sun, 25 Apr 2021 08:19:04 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 25 Apr 2021 10:19:04 -0500
From: Stefan Kangas <stefan@HIDDEN>
In-Reply-To: <b1a4c710-af9a-7ab8-36dc-9348a4a1d2ae@HIDDEN>
References: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN>
 <CADwFkm=7SdBBoBSvxMN9FQiiVwJOEiV_xp45d7fyKdMwz2gDSQ@HIDDEN>
 <b1a4c710-af9a-7ab8-36dc-9348a4a1d2ae@HIDDEN>
MIME-Version: 1.0
Date: Sun, 25 Apr 2021 10:19:04 -0500
Message-ID: <CADwFkmk9AL9r2ShWYVc=CB+wVzj_wfz84FVBid0S8iELZAkemQ@HIDDEN>
Subject: Re: bug#48009: 28.0.50; Support query-regexp-replace using re-builder
To: Phil Sainty <psainty@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 48009
Cc: 48009 <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 (/)

Phil Sainty <psainty@HIDDEN> writes:

> That could be very nice, although it feels like a pretty significant
> complication.  Also, re-builder's interactive updates can sometimes
> need a manual C-c C-u (`reb-force-update') if it gets confused (which
> I think occasionally happens when the regexp is invalid?), and that
> might not be great.

True, it would need to be robust enough to handle most of what you throw
at it.  But even with some warts, it would be a significant improvement,
I think.  If it is optional, users run less risk of being caught
unawares.

A naive approach would be to run something akin to `reb-force-update'
automatically after some delay, but I have no idea if that would work in
practice.

> Or did you mean to use the isearch highlighting code, which is perhaps
> more forgiving of temporary invalid states?

I'm not familiar with the code, so I can't help with ideas for how to
best implement something like this, unfortunately.




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

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


Received: (at 48009) by debbugs.gnu.org; 25 Apr 2021 14:51:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 25 10:51:47 2021
Received: from localhost ([127.0.0.1]:43383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lag6t-0004nr-Fb
	for submit <at> debbugs.gnu.org; Sun, 25 Apr 2021 10:51:47 -0400
Received: from smtp-2.orcon.net.nz ([60.234.4.43]:33289)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1lag6r-0004nh-5n
 for 48009 <at> debbugs.gnu.org; Sun, 25 Apr 2021 10:51:45 -0400
Received: from [101.53.216.162] (port=13153 helo=[192.168.20.103])
 by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>)
 id 1lag6o-0001Gw-Sd; Mon, 26 Apr 2021 02:51:43 +1200
Subject: Re: bug#48009: 28.0.50; Support query-regexp-replace using re-builder
To: Stefan Kangas <stefan@HIDDEN>
References: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN>
 <CADwFkm=7SdBBoBSvxMN9FQiiVwJOEiV_xp45d7fyKdMwz2gDSQ@HIDDEN>
From: Phil Sainty <psainty@HIDDEN>
Message-ID: <b1a4c710-af9a-7ab8-36dc-9348a4a1d2ae@HIDDEN>
Date: Mon, 26 Apr 2021 02:51:42 +1200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <CADwFkm=7SdBBoBSvxMN9FQiiVwJOEiV_xp45d7fyKdMwz2gDSQ@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
X-GeoIP: NZ
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 48009
Cc: 48009 <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: -1.7 (-)

On 25/04/21 10:46 pm, Stefan Kangas wrote:
> Why not make `query-replace-regexp' work exactly like isearch does,
> i.e. interactively update its matches?  I.e. why should users need
> to know about `re-builder' to take advantage of this?
>
> Something like that could be added in addition to a command to go
> from `re-builder' to `query-replace-regexp'.

That could be very nice, although it feels like a pretty significant
complication.  Also, re-builder's interactive updates can sometimes
need a manual C-c C-u (`reb-force-update') if it gets confused (which
I think occasionally happens when the regexp is invalid?), and that
might not be great.

Or did you mean to use the isearch highlighting code, which is perhaps
more forgiving of temporary invalid states?





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

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


Received: (at 48009) by debbugs.gnu.org; 25 Apr 2021 10:46:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 25 06:46:50 2021
Received: from localhost ([127.0.0.1]:42078 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lacHq-0004nC-9B
	for submit <at> debbugs.gnu.org; Sun, 25 Apr 2021 06:46:50 -0400
Received: from mail-pj1-f49.google.com ([209.85.216.49]:37665)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1lacHh-0004mh-Qu
 for 48009 <at> debbugs.gnu.org; Sun, 25 Apr 2021 06:46:42 -0400
Received: by mail-pj1-f49.google.com with SMTP id
 e8-20020a17090a7288b029014e51f5a6baso3537454pjg.2
 for <48009 <at> debbugs.gnu.org>; Sun, 25 Apr 2021 03:46:41 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:in-reply-to:references:user-agent
 :mime-version:date:message-id:subject:to:cc;
 bh=D6bA5kq3Fd/HF9rPvQ2K5c7Ez8F6evvXo8bZEMUntCE=;
 b=Qk7+vACuS2oXNo3r1IBIfVM8dqHUg5RP6++aVAH4kIkj4JjmNQ0tngERg2LRb4Q9s6
 MjByEbNnyTKNnvOBEleYgbMXhej4hyharMSDCkS8SLyNIKlZAWgt9fUkyvC07W8z4AMK
 pctk4rZNEJtDFy9g+qWZKMvoFWIQ5KqR3Ml1tEyxXVa+JAk2M/608iymoZ3t0FYmNcZh
 yzcc6yFvRYYZT6qFKFG6D4GnS6rwm4+QKyN8JGrkhC+A89m1MVSGZpz3R0jniBhZJYta
 rjxH/EyRQBQTDfMtqbzRw3255lc2w+PXqC/oZ/T4aWPaHjnILbS+I3Krb9Be9si2F/gs
 Fw3w==
X-Gm-Message-State: AOAM5308Gkj/TwKJUVg/D0O2cw6UDJQJwn+ZJJszEjXUsAJUn/1u+UOq
 hTBI5vExV+g6WqrJGfjS0RQAeMqF1/vWx1vafv+TwJh3
X-Google-Smtp-Source: ABdhPJxZwwYLicDeTKXg/bcWdXazYu2EqFDkNC+9STxSJPs63bKXQ3sI9Px1escz2hax5Z5S0R1zEvThIGXJWm6qrRg=
X-Received: by 2002:a17:902:e9c4:b029:eb:4626:feba with SMTP id
 4-20020a170902e9c4b02900eb4626febamr13491637plk.39.1619347596163; Sun, 25 Apr
 2021 03:46:36 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 25 Apr 2021 05:46:35 -0500
From: Stefan Kangas <stefan@HIDDEN>
In-Reply-To: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN> (Phil
 Sainty's message of "Sun, 25 Apr 2021 15:36:07 +1200")
References: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Date: Sun, 25 Apr 2021 05:46:35 -0500
Message-ID: <CADwFkm=7SdBBoBSvxMN9FQiiVwJOEiV_xp45d7fyKdMwz2gDSQ@HIDDEN>
Subject: Re: bug#48009: 28.0.50; Support query-regexp-replace using re-builder
To: Phil Sainty <psainty@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 48009
Cc: 48009 <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 (/)

Phil Sainty <psainty@HIDDEN> writes:

> It would be nice to be able to use `re-builder' to interactively
> craft a regexp to pass to `query-replace-regexp' in a streamlined
> manner.

I think it's a good idea.

> I initially wondered about a command for "query-replace-regexp but
> automatically using re-builder" (i.e. instead of typing M-C-%), but
> I'm not sure that would be very different to just binding `re-builder'
> to a key, as you'd still need a custom binding from inside re-builder
> to say you were done.  Perhaps such a command would automatically
> close the re-builder buffer once the replacements stopped, though?

Why not make `query-replace-regexp' work exactly like isearch does,
i.e. interactively update its matches?  I.e. why should users need to
know about `re-builder' to take advantage of this?

Something like that could be added in addition to a command to go from
`re-builder' to `query-replace-regexp'.




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

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


Received: (at submit) by debbugs.gnu.org; 25 Apr 2021 03:36:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 24 23:36:17 2021
Received: from localhost ([127.0.0.1]:41831 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1laVZB-0002Ow-Id
	for submit <at> debbugs.gnu.org; Sat, 24 Apr 2021 23:36:17 -0400
Received: from lists.gnu.org ([209.51.188.17]:44168)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1laVZ8-0002On-Km
 for submit <at> debbugs.gnu.org; Sat, 24 Apr 2021 23:36:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35452)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <psainty@HIDDEN>)
 id 1laVZ8-00035P-5F
 for bug-gnu-emacs@HIDDEN; Sat, 24 Apr 2021 23:36:14 -0400
Received: from smtp-4.orcon.net.nz ([60.234.4.59]:54937)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <psainty@HIDDEN>)
 id 1laVZ5-0007mo-0h
 for bug-gnu-emacs@HIDDEN; Sat, 24 Apr 2021 23:36:13 -0400
Received: from [101.53.216.162] (port=29582 helo=[192.168.20.103])
 by smtp-4.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>) id 1laVZ1-00008f-DK
 for bug-gnu-emacs@HIDDEN; Sun, 25 Apr 2021 15:36:08 +1200
To: bug-gnu-emacs@HIDDEN
From: Phil Sainty <psainty@HIDDEN>
Subject: 28.0.50; Support query-regexp-replace using re-builder
Message-ID: <d285a7fb-f7bd-545f-1d1b-7ed4f9abb461@HIDDEN>
Date: Sun, 25 Apr 2021 15:36:07 +1200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
X-GeoIP: NZ
Received-SPF: pass client-ip=60.234.4.59; envelope-from=psainty@HIDDEN;
 helo=smtp-4.orcon.net.nz
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
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: -2.6 (--)

It would be nice to be able to use `re-builder' to interactively
craft a regexp to pass to `query-replace-regexp' in a streamlined
manner.

Here's a starter, which you can call from `re-builder'.

 (defun reb-query-replace-regexp ()
   "Invoke `query-replace-regexp' in the target buffer."
   (interactive)
   (let ((from (reb-target-binding reb-regexp)))
     (with-selected-window reb-target-window
       (with-current-buffer reb-target-buffer
         (let ((to (query-replace-read-to from "Query replace regexp" t)))
           (query-replace-regexp from to))))))

 (define-key reb-mode-map (kbd "C-c %") #'reb-query-replace-regexp)
 (define-key reb-lisp-mode-map (kbd "C-c %") #'reb-query-replace-regexp)


A complete solution would presumably support the other
`query-replace-regexp' arguments.

I initially wondered about a command for "query-replace-regexp but
automatically using re-builder" (i.e. instead of typing M-C-%), but
I'm not sure that would be very different to just binding `re-builder'
to a key, as you'd still need a custom binding from inside re-builder
to say you were done.  Perhaps such a command would automatically
close the re-builder buffer once the replacements stopped, though?

What do people think?


-Phil


In GNU Emacs 28.0.50 (build 8, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.10, Xaw3d scroll bars)
 of 2021-04-18 built on shodan
Repository revision: 75c898edc3d7e06b589ce42917ae56e0c40082ac
Repository branch: feature/native-comp
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 18.04.5 LTS





Acknowledgement sent to Phil Sainty <psainty@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#48009; 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: Tue, 27 Apr 2021 14:15:01 UTC

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