Subject: bug#6227: Color isearch regexp submatches differently

From: Drew Adams <[email-masked]>
Date: Sun, 20 Sep 2020 21:49:26 -0700 (PDT)

> > I'd rather go the other way, to be honest -- just leave group-1 to -3,
> > perhaps.  I think it's rather unusual to have a that many sub-groups
> > interactively...
> 
> That's true, but the problem which bothers me is that customizing
> search-highlight-submatches alone to a larger value is not enough.  I
> don't think any other customization we have requires users to create
> faces or similar objects.

FWIW, the option in Isearch+ is just a boolean, not
a max number of levels/groups.  I use it for both
Isearch and `replace-highlight'.  The use cases are
only interactive, AFAICimagine, and I don't imagine
(and haven't seen) any need for lots of levels.  I
use 8 levels, and that's already a lot.

As for the relation between your max # groups and
faces: if you really want to let users change the
max # (not needed, I think), you can just have a
fixed number of faces and recycle them.  You don't
have to imagine that users will need to both (1)
increase `search-highlight-submatches' and (2)
create corresponding new faces for the additional
groups to be matched.  It's pretty clear which
level is involved if the same color is used for,
say, level 2 and level 10.

I mentioned this recycling possibility earlier,
saying that I considered going through the 1-8
faces I have and then going through them again, for
groups 9-18, and again,...  But I've never seen any
need for that.  Your design sounds like overkill, if
the intention is just interactive use.

Just a suggestion.

Also, your option name should have "max" in it, I
think.  And if you use it only for Isearch, then
maybe use "isearch", not "search" in the name.