unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50845: Color capturing groups in query replace regexp
@ 2021-09-27 12:54 ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-09-27 13:03 ` Lars Ingebrigtsen
  2021-09-27 16:08 ` bug#50845: [External] : " Drew Adams
  0 siblings, 2 replies; 5+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-27 12:54 UTC (permalink / raw)
  To: 50845

When doing some complex capturing and replacing it could be helpful to see what each of the groups captured.

So instead of coloring the match with a single color when query replacing, the part captured by the first parens
has one color, the second capturing group a different color, etc. and after replacing if the user used a
comma to replace but not move point to the next match, the same colors indicate the replacement texts for the
corresponding groups.

And the matching parts outside of parens can have the same face which qrr currently uses.





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

* bug#50845: Color capturing groups in query replace regexp
  2021-09-27 12:54 bug#50845: Color capturing groups in query replace regexp ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-09-27 13:03 ` Lars Ingebrigtsen
  2021-09-27 13:12   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-09-27 16:08 ` bug#50845: [External] : " Drew Adams
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-27 13:03 UTC (permalink / raw)
  To: 50845; +Cc: ndame

ndame via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:

> When doing some complex capturing and replacing it could be helpful to
> see what each of the groups captured.

You don't say what Emacs version you're reporting this for, but in Emacs
28, the `isearch-group-2' and `isearch-group-1' faces are used for
this.  (That is, it's even/odd group matches.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50845: Color capturing groups in query replace regexp
  2021-09-27 13:03 ` Lars Ingebrigtsen
@ 2021-09-27 13:12   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-09-27 13:20     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-27 13:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50845


>
> You don't say what Emacs version you're reporting this for, but in Emacs
> 28, the `isearch-group-2' and` isearch-group-1' faces are used for
> this. (That is, it's even/odd group matches.)

Emacs 27. I should have checked. This report can be closed then. Thanks.






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

* bug#50845: Color capturing groups in query replace regexp
  2021-09-27 13:12   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-09-27 13:20     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-27 13:20 UTC (permalink / raw)
  To: ndame; +Cc: 50845

ndame <laszlomail@protonmail.com> writes:

>> You don't say what Emacs version you're reporting this for, but in Emacs
>> 28, the `isearch-group-2' and` isearch-group-1' faces are used for
>> this. (That is, it's even/odd group matches.)
>
> Emacs 27. I should have checked. This report can be closed then. Thanks.

OK; closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50845: [External] : bug#50845: Color capturing groups in query replace regexp
  2021-09-27 12:54 bug#50845: Color capturing groups in query replace regexp ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-09-27 13:03 ` Lars Ingebrigtsen
@ 2021-09-27 16:08 ` Drew Adams
  1 sibling, 0 replies; 5+ messages in thread
From: Drew Adams @ 2021-09-27 16:08 UTC (permalink / raw)
  To: ndame, 50845@debbugs.gnu.org

> When doing some complex capturing and replacing it could be helpful to
> see what each of the groups captured.
> 
> So instead of coloring the match with a single color when query
> replacing, the part captured by the first parens
> has one color, the second capturing group a different color, etc. and
> after replacing if the user used a
> comma to replace but not move point to the next match, the same colors
> indicate the replacement texts for the
> corresponding groups.
> 
> And the matching parts outside of parens can have the same face which
> qrr currently uses.

FWIW, together, my libraries `isearch+.el' and
`replace+.el' do that.  (The former does it
also for Isearch.)

Each regexp group match is highlighted in the
currently search hit, and in other hits than the
current one the odd and even group matches are
highlighted (odd and even faces).

IMO, this feature is really helpful.  Regexp
matches should be shown this way, in general.
(Of course, it's optional for users.)

https://www.emacswiki.org/emacs/download/isearch%2b.el

https://www.emacswiki.org/emacs/download/replace%2b.el



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

end of thread, other threads:[~2021-09-27 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 12:54 bug#50845: Color capturing groups in query replace regexp ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-27 13:03 ` Lars Ingebrigtsen
2021-09-27 13:12   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-27 13:20     ` Lars Ingebrigtsen
2021-09-27 16:08 ` bug#50845: [External] : " Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).