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

From: Juri Linkov <[email-masked]>
Date: Tue, 06 Oct 2020 23:01:16 +0300

> As I mentioned, it's simple to just repeat the use
> of the same 8 faces, for 9-16, 17-24, etc.

This is a very good idea.  Now this is implemented in isearch.

> I've added a third screenshot, where I did this:
> recycle the faces of groups 1-5 for groups 9-13.

Yes, recycling is nice, this is what now is used in isearch.

> The foreground for each group is apparently taken
> from the foreground of face `isearch'.  I guess I
> hadn't paid attention to that.  I think that's
> unfortunate, in general.  I probably didn't notice
> it because in my own setup I've customized face
> `isearch' to use a black foreground (and a green
> background).
>
> I think the default foreground for face `isearch'
> should be something that works well with each of
> the default group faces, and that's not likely to
> be `lightskyblue1'.  Change it to `black' and the
> regexp group highlighting is quite good.  You need
> to be able to see the text that the regexp parts
> apply to.
>
> I also tried just removing a foreground spec from
> the vanilla default for face `isearch'.  In the
> case shown, which is *scratch*, the text has face
> `font-lock-comment-face'.  And if face `isearch'
> doesn't have a good foreground spec (e.g. `black')
> then the result isn't great.  (But at least it's
> better than with foreground `lightskyblue1'.)
>
> As I've just noticed this problem now, and as I
> don't want to impose any default change on face
> `isearch' in my code, I've now changed the default
> regexp group faces to each specify a `black'
> foreground (instead of no foreground), for a light
> background mode.

You see?  So many problems when you tried to design
a color palette for many isearch faces.

I suppose you agree that the previous color palette in isearch
with a color gradient is not suitable for highlighting of group matches
because while looking at highlighted matches it's quite impossible to
say which color corresponds to which group number.
I meant when colors looks like a heatmap, for example:

would anyone be able to say a number while looking at a color?

I see that you are using more distinct colors,
but still these colors are bleak.

Other examples of color scheme are in re-builder and hi-lock faces.

Personally, I'd like to use rainbow colors in own customization:

But frankly speaking such color palette looks like angry fruit salad.

What is the most reasonable thing to do is to delegate the decision
about the color scheme selection to theme authors and to user customization.

So now isearch provides two distinct recycling colors based on the default
isearch color scheme.

> The third screenshot (which recycles faces 1-5 for
> 9-13) shows this: a black foreground for each face
> used for the current search hit (but not for lazy
> highlighting).

Recycling is now implemented in isearch.
Thanks for the idea.