Subject: bug#43702: Emacs master: Incorrect highlighting in regexp isearch.

From: Juri Linkov <[email-masked]>
Date: Wed, 07 Oct 2020 11:13:35 +0300

> See attached, which are the faces I use by default
> (for a light background mode).
>
> It's harder to tell 3 from 7, but needing to do that will be
> relatively rare.

I agree, it's hard to tell 3 from 7 when highlighting a complex nested regexp.

>> I started implementing group matches highlighting for lazy-highlight and also
>> for query-replace, but then realized neither lazy-highlight nor query-replace
>> need no such thing because this highlighting is only useful while
>> incrementally constructing/inspecting a complex regexp for the current match
>> in incremental isearch mode.
>
> I don't agree, but won't argue about it.  I redefined
> `replace-highlight' and `replace-dehighlight' so they
> do highlight regexp groups, and I think it's helpful.

After query-replace is started, the regexp is already created
(either with the help of isearch group submatches highlighting
or typed directly on the query-replace prompt), so during replacements
the user has only to decide for each match whether to replace it or not
by answering the y/n question for the currently highlighted regexp.

How highlighting the replacement submatches will help the user to decide
whether to replace the current match or not?