Subject: bug#6227: Color isearch regexp submatches differently

From: Lennart Borgman <[email-masked]>
Date: Sun, 23 May 2010 02:51:48 +0200

On Sun, May 23, 2010 at 1:44 AM, Juri Linkov <[email-masked]> wrote:
>>> We already have highlighting like that: lisp/emacs-lisp/re-builder.el
>>> uses faces `reb-match-1', `reb-match-2', `reb-match-3' to highlight
>>> regexp subexpressions.  I think this should be used by isearch.
>>
>> That sounds right to me.
>>
>> Also Drew suggestion to not color submatches in lazy marking seems right.
>
> (add-hook 'isearch-update-post-hook
>          (lambda ()
>            (require 're-builder)
>            (when isearch-regexp
>              (let ((reb-regexp isearch-string)
>                    (reb-target-buffer (current-buffer))
>                    (reb-target-window (selected-window)))
>                (reb-update-overlays)))))
>
> (add-hook 'isearch-mode-end-hook
>          (lambda ()
>            (let ((reb-target-buffer (current-buffer)))
>              (reb-delete-overlays))))

Nice. So I suggest moving (and renaming) `reb-count-subexps' to
isearch.el and splitting off the marking of one overlay from
`reb-update-overlays' and moving that too to isearch.el (since
isearch.el) is probably always loaded for a normal Emacs user).