all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Juri Linkov <juri@linkov.net>
Cc: Alan Mackenzie <acm@muc.de>, Lars Ingebrigtsen <larsi@gnus.org>,
	43702@debbugs.gnu.org
Subject: bug#43702: Emacs master: Incorrect highlighting in regexp isearch.
Date: Thu, 1 Oct 2020 15:41:48 -0700 (PDT)	[thread overview]
Message-ID: <f94c384c-65ca-4f55-b627-2b1020a9c66f@default> (raw)
In-Reply-To: <20200929121317.GA27007@ACM>

[-- Attachment #1: Type: text/plain, Size: 3035 bytes --]

FWIW, attached are three screenshots using Isearch+
for the same regexp search as Juri's screenshot, and
starting with emacs -Q (just loading isearch+.el).

I can't tell from Juri's screenshot just what regexp
he used.  Seven regexp groups are shown in the echo
area, but the non-lazy highlighting seems to show 13
groups.

The first two attached screenshots are with 7 and 13
groups, respectively.  They show the default
highlighting for both the current search hit and the
other search hits (lazy highlighting).

I think you can see the advantage of having lazy
highlighting indicate groups, at least in a gross
way (even/odd).

Because Isearch+ has only 8 group faces defined,
matches beyond the 8th are not indicated in the
current search hit, in these first two screenshots.

As I mentioned, it's simple to just repeat the use
of the same 8 faces, for 9-16, 17-24, etc.  But
that won't help you distinguish group 1 from group
9 etc.

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

The faces for the overall current search hit and
the even lazy-highlight hits are the vanilla
default faces, `isearch' and `lazy-highlight'.

The default values of the group faces are also
used.  By default, only the background color is
defined for each group face.

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.

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

The regexp used by Juri is extremely atypical, IMO.

A more typical regexp that uses multiple groups
involves some group nesting, and in that case there's
little (typically no) problem distinguishing group 1
from group 9, group 2 from group 10, etc.

[-- Attachment #2: throw-emacs-isearch+-regexp-highlighting.png --]
[-- Type: image/png, Size: 27278 bytes --]

[-- Attachment #3: throw-emacs-isearch+-regexp-highlighting-2.png --]
[-- Type: image/png, Size: 26583 bytes --]

[-- Attachment #4: throw-emacs-isearch+-regexp-highlighting-3.png --]
[-- Type: image/png, Size: 25527 bytes --]

  parent reply	other threads:[~2020-10-01 22:41 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 12:13 bug#43702: Emacs master: Incorrect highlighting in regexp isearch Alan Mackenzie
2020-09-29 14:43 ` Eli Zaretskii
2020-09-29 15:33   ` Alan Mackenzie
2020-09-29 16:07     ` Eli Zaretskii
2020-09-30  2:08     ` Lars Ingebrigtsen
2020-09-30 19:16       ` Juri Linkov
2020-09-30 21:28         ` Drew Adams
2020-10-01 19:11           ` Juri Linkov
2020-10-01 19:38             ` Drew Adams
2020-10-01 22:41             ` Drew Adams [this message]
2020-10-06 20:01               ` Juri Linkov
2020-10-06 22:40                 ` Drew Adams
2020-10-07  8:13                   ` Juri Linkov
2020-10-07 15:42                     ` Drew Adams
2020-10-12 19:59                       ` Juri Linkov
2020-10-12 23:07                         ` Drew Adams
2020-10-13 20:14                           ` Juri Linkov
2020-10-13 20:54                             ` Drew Adams
2020-10-14  8:57                               ` Juri Linkov
2020-10-14 17:03                                 ` Drew Adams
2020-10-07  7:16                 ` Eli Zaretskii
2020-10-07  8:09                   ` Juri Linkov
2020-10-07  9:14                     ` Eli Zaretskii
2020-10-07 19:09                       ` Juri Linkov
2020-10-07 20:02                         ` Drew Adams
2020-10-07 20:22                           ` Juri Linkov
2020-10-07 20:56                             ` Drew Adams
2020-10-01  1:12         ` Lars Ingebrigtsen
2020-10-01 19:20           ` Juri Linkov
2020-10-01 19:23             ` Lars Ingebrigtsen
2020-10-01 19:26             ` Eli Zaretskii
2020-10-01 19:39             ` Drew Adams
2020-10-02  6:57               ` Juri Linkov
2020-10-06 20:17             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f94c384c-65ca-4f55-b627-2b1020a9c66f@default \
    --to=drew.adams@oracle.com \
    --cc=43702@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.