[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6227: Color isearch regexp submatches differently

From: Lennart Borgman
Subject: bug#6227: Color isearch regexp submatches differently
Date: Wed, 9 Jun 2010 11:14:03 +0200

On Wed, Jun 9, 2010 at 10:36 AM, Juri Linkov <address@hidden> wrote:
>> Here is a patch for the submatches highlighting.
>> (It includes a bug fix for the prompt face too
> What's a bug in the prompt face?

There is a variable, minibuffer-prompt-properties, that holds the name
of the face to use. I think this should be used for consistency. It
makes it much easier for users.

>> and a help window scrolling I think is useful.)
> Please provide an example of the scrolling bug too.

I am not sure on that one. Maybe I just forgot to remove it when you
implemented your way of doing it?

>> The current faces does not look very well together so that must be fixed.
> If current faces does not look well, then maybe we should completely
> get rid of using re-builder.el in isearch, its faces and messy functions
> like count-subexps, and to write this functionality for isearch from scratch.

I thought maybe something like count-subexps is needed now with the
numbered submatches.

> Do you think something more complicated is necessary for this
> functionality than the following simple code:
> (defvar isearch-sub-overlays nil)
> (add-hook 'isearch-update-post-hook
>          (lambda ()
>            ;; This code could be added to `isearch-highlight'.
>            (mapc 'delete-overlay isearch-sub-overlays)
>            (setq isearch-sub-overlays nil)
>            (when isearch-regexp
>              (dolist (i '(1 2 3 4))
>                (when (match-beginning i)
>                  (let ((ov (make-overlay (match-beginning i) (match-end i))))
>                    (overlay-put ov 'face (intern-soft (format "isearch-%d" 
> i)))
>                    (overlay-put ov 'priority 1002)
>                    (push ov isearch-sub-overlays)))))))

It does not take care of numbered matches. But, yes, why not guess? I
agree, your approach is probably better. But check for more
submatches. Maybe upto the value of some variable, say

> It relies on new faces `isearch-1', `isearch-2', `isearch-3', `isearch-4'.
> As for face colors, I tried "magenta1", "magenta2", "magenta3", "magenta4"
> for background colors, and they look good.

The problem with mixing isearch faces with re-builder dito was the
resulting colors from merging. If it works then just use your

I  have rewritten re-builder.el and got rid of its internal. Just need
to cleanup a bit. Now it is just a front end to isearch with more
editing capabilities, like rx. I think that can be useful.

I plan to keep three "regexp source styles" there and maybe rename
them a bit: regexp, string (or maybe read) and rx. I think those names
are self explanatory. Unfortunately re-builder now uses string/read
instead of regexp/string which is more user-level names.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]