When searching for regular expressions (with @kbd{C-M-s}, for
instance), subexpressions receive special highlighting depending on
the @code{search-highlight-submatches} variable. If this variable's
-value is zero, no special highlighting is done, but if the value is a
-positive integer @var{n}, the strings matching the first @var{n}
-@samp{\( @dots{} \)} constructs (a.k.a.@: ``subexpressions'') in the
-regular expression will be highlighted with distinct faces, named
-@code{isearch-group-@var{n}}. For instance, when searching for
-@samp{foo-\([0-9]+\)}, the part matched by @samp{[0-9]+} will be
-highlighted with the @code{isearch-group-1} face if
-@code{search-highlight-submatches} is greater or equal to 1. The
-default value of @code{search-highlight-submatches} is 5.
+value is @code{nil}, no special highlighting is done, but if the value
+is non-@code{nil}, text that matches @samp{\( @dots{} \)} constructs
+(a.k.a.@: ``subexpressions'') in the regular expression will be
+highlighted with distinct faces, named @code{isearch-group-@var{n}}.
+For instance, when searching for @samp{foo-\([0-9]+\)}, the part
+matched by @samp{[0-9]+} will be highlighted with the
+@code{isearch-group-1} face.
@cindex lazy highlighting customizations
@vindex isearch-lazy-highlight
"Non-nil means incremental search highlights the current match."
:type 'boolean)
-(defcustom search-highlight-submatches 5
+(defcustom search-highlight-submatches t
"Whether to highlight regexp subexpressions of the current regexp match.
-A positive integer N means highlight regexp subexpressions 1 to N.
-
-When 0, do not highlight regexp subexpressions. A negative value is
-treated as zero.
The faces used to do the highlights are named `isearch-group-1',
-`isearch-group-2', and so on, and if you increase this variable from
-the default, you have to add more of these faces."
- :type 'integer
+`isearch-group-2', and so on."
+ :type 'boolean
:version "28.1")
(defface isearch
:group 'isearch
:version "28.1")
+(defface isearch-group-6
+ '((((class color) (background light))
+ (:background "#500050" :foreground "lightskyblue1"))
+ (((class color) (background dark))
+ (:background "#703050" :foreground "white"))
+ (t (:inverse-video t)))
+ "Face for highlighting Isearch sub-group matches (sixth sub-group)."
+ :group 'isearch
+ :version "28.1")
+
+(defface isearch-group-7
+ '((((class color) (background light))
+ (:background "#400040" :foreground "lightskyblue1"))
+ (((class color) (background dark))
+ (:background "#602050" :foreground "white"))
+ (t (:inverse-video t)))
+ "Face for highlighting Isearch sub-group matches (seventh sub-group)."
+ :group 'isearch
+ :version "28.1")
+
+(defface isearch-group-8
+ '((((class color) (background light))
+ (:background "#300030" :foreground "lightskyblue1"))
+ (((class color) (background dark))
+ (:background "#501050" :foreground "white"))
+ (t (:inverse-video t)))
+ "Face for highlighting Isearch sub-group matches (eighth sub-group)."
+ :group 'isearch
+ :version "28.1")
+
+(defface isearch-group-9
+ '((((class color) (background light))
+ (:background "#200020" :foreground "lightskyblue1"))
+ (((class color) (background dark))
+ (:background "#400040" :foreground "white"))
+ (t (:inverse-video t)))
+ "Face for highlighting Isearch sub-group matches (ninth sub-group)."
+ :group 'isearch
+ :version "28.1")
+
+
(defun isearch-highlight (beg end)
(if search-highlight
(if isearch-overlay
;; 1001 is higher than lazy's 1000 and ediff's 100+
(overlay-put isearch-overlay 'priority 1001)
(overlay-put isearch-overlay 'face isearch-face)))
- (when (and (integerp search-highlight-submatches)
- (> search-highlight-submatches 0)
+ (when (and search-highlight-submatches
isearch-regexp)
(mapc 'delete-overlay isearch-submatches-overlays)
(setq isearch-submatches-overlays nil)
(let ((i 0) ov)
- (while (<= i search-highlight-submatches)
+ (while (<= i 9)
(when (match-beginning i)
(setq ov (make-overlay (match-beginning i) (match-end i)))
(overlay-put ov 'face (intern-soft (format "isearch-group-%d" i)))