GNU bug report logs - #6227
Color isearch regexp submatches differently

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Thu, 20 May 2010 11:13:01 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 6227 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6227 <at> debbugs.gnu.org
Subject: Re: bug#6227: Color isearch regexp submatches differently
Date: Wed, 09 Jun 2010 11:36:38 +0300
> 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?

> and a help window scrolling I think is useful.)

Please provide an example of the scrolling bug too.

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

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

-- 
Juri Linkov
http://www.jurta.org/emacs/




This bug report was last modified 4 years and 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.