unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Query replace question
       [not found] <20220317111952.zwm7bmvtsdnede7i.ref@Ergus>
@ 2022-03-17 11:19 ` Ergus
  2022-03-17 11:30   ` Robert Pluim
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ergus @ 2022-03-17 11:19 UTC (permalink / raw)
  To: help-gnu-emacs

Hi:

I am wondering if there is some functionality in vanilla to enable
dynamic match highlight during query replace or query-replace regex
while composing the regex? Similar to isearch lazy highlight,
regex-highlight or re-builder; but for query-replace and the rest of the
replace family?

I feel very uncomfortable not getting a feedback while writing the regex
during the query-replace-regex. Specially when the regex is a bit
complex, uses capture groups or so. I am sure some others have had a
similar experience and I will be surprised that no solution will be
already implemented.

Any idea?
Best,
Ergus



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query replace question
  2022-03-17 11:19 ` Query replace question Ergus
@ 2022-03-17 11:30   ` Robert Pluim
  2022-03-17 14:40     ` Eric Abrahamsen
  2022-03-17 17:03   ` Juri Linkov
  2022-03-17 18:49   ` Stefan Monnier via Users list for the GNU Emacs text editor
  2 siblings, 1 reply; 5+ messages in thread
From: Robert Pluim @ 2022-03-17 11:30 UTC (permalink / raw)
  To: Ergus; +Cc: help-gnu-emacs

>>>>> On Thu, 17 Mar 2022 12:19:52 +0100, Ergus <spacibba@aol.com> said:

    Ergus> Hi:
    Ergus> I am wondering if there is some functionality in vanilla to enable
    Ergus> dynamic match highlight during query replace or query-replace regex
    Ergus> while composing the regex? Similar to isearch lazy highlight,
    Ergus> regex-highlight or re-builder; but for query-replace and the rest of the
    Ergus> replace family?

You can search with isearch and then switch to query-replace with M-%
from within isearch.

Robert
-- 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query replace question
  2022-03-17 11:30   ` Robert Pluim
@ 2022-03-17 14:40     ` Eric Abrahamsen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2022-03-17 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Pluim <rpluim@gmail.com> writes:

>>>>>> On Thu, 17 Mar 2022 12:19:52 +0100, Ergus <spacibba@aol.com> said:
>
>     Ergus> Hi:
>     Ergus> I am wondering if there is some functionality in vanilla to enable
>     Ergus> dynamic match highlight during query replace or query-replace regex
>     Ergus> while composing the regex? Similar to isearch lazy highlight,
>     Ergus> regex-highlight or re-builder; but for query-replace and the rest of the
>     Ergus> replace family?
>
> You can search with isearch and then switch to query-replace with M-%
> from within isearch.

There's also re-builder, which is interactive. It can sort of serve as a
replacement for `isearch-forward-regexp', or you can copy the regexp
once you've got it right, and use it in regexp replace.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query replace question
  2022-03-17 11:19 ` Query replace question Ergus
  2022-03-17 11:30   ` Robert Pluim
@ 2022-03-17 17:03   ` Juri Linkov
  2022-03-17 18:49   ` Stefan Monnier via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2022-03-17 17:03 UTC (permalink / raw)
  To: Ergus; +Cc: help-gnu-emacs

> I am wondering if there is some functionality in vanilla to enable
> dynamic match highlight during query replace or query-replace regex
> while composing the regex? Similar to isearch lazy highlight,
> regex-highlight or re-builder; but for query-replace and the rest of the
> replace family?
>
> I feel very uncomfortable not getting a feedback while writing the regex
> during the query-replace-regex. Specially when the regex is a bit
> complex, uses capture groups or so. I am sure some others have had a
> similar experience and I will be surprised that no solution will be
> already implemented.
>
> Any idea?

This is exactly what is currently under development in bug#53126.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query replace question
  2022-03-17 11:19 ` Query replace question Ergus
  2022-03-17 11:30   ` Robert Pluim
  2022-03-17 17:03   ` Juri Linkov
@ 2022-03-17 18:49   ` Stefan Monnier via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-03-17 18:49 UTC (permalink / raw)
  To: help-gnu-emacs

Ergus [2022-03-17 12:19:52] wrote:
> I am wondering if there is some functionality in vanilla to enable
> dynamic match highlight during query replace or query-replace regex
> while composing the regex? Similar to isearch lazy highlight,
> regex-highlight or re-builder; but for query-replace and the rest of the
> replace family?

You can do the query&replace from Isearch:

    C-u C-s <regexp> M-C-% <replacement> RET

In my world, this is the normal way to do a "query replace".
I only invoked straight query-replace when I want to repeat a previous
replacement.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-17 18:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220317111952.zwm7bmvtsdnede7i.ref@Ergus>
2022-03-17 11:19 ` Query replace question Ergus
2022-03-17 11:30   ` Robert Pluim
2022-03-17 14:40     ` Eric Abrahamsen
2022-03-17 17:03   ` Juri Linkov
2022-03-17 18:49   ` Stefan Monnier via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).