Subject: bug#60794: [PATCH] (rainbow.el) Add matching option to rainbow-colorize-hexadecimal-without-sharp

From: Dimitri Belopopsky <[email-masked]>
Date: Fri, 13 Jan 2023 21:24:14 +0100

Hello,

I made a modification to "rainbow-colorize-hexadecimal-without-sharp" in
rainbow-mode which allows passing a "match" option. I needed this to match
subgroups on complex strings, in my case to highlight the hexadecimal
inside Color::hex("FFF") without colouring the whole expression.

I think it could be useful to more people.

Kind regards,
From 691545fda48fd30261b62503a8bdbcbcbbe9e49d Mon Sep 17 00:00:00 2001
From: Dimitri Belopopsky <[email-masked]>
Date: Mon, 28 Nov 2022 23:15:03 +0100
Subject: [PATCH] Add matching option to
 rainbow-colorize-hexadecimal-without-sharp

* rainbow-mode.el (rainbow-colorize-hexadecimal-without-sharp) Add
Add matching option to rainbow-colorize-hexadecimal-without-sharp
---
 rainbow-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rainbow-mode.el b/rainbow-mode.el
index 14bf442..9bd4a83 100644
--- a/rainbow-mode.el
+++ b/rainbow-mode.el
@@ -1033,9 +1033,9 @@ background is COLOR. The foreground is computed using
   "Colorize a match with itself."
   (rainbow-colorize-match (match-string-no-properties (or match 0)) match))
 
-(defun rainbow-colorize-hexadecimal-without-sharp ()
+(defun rainbow-colorize-hexadecimal-without-sharp (&optional match)
   "Colorize an hexadecimal colors and prepend # to it."
-  (rainbow-colorize-match (concat "#" (match-string-no-properties 1))))
+  (rainbow-colorize-match (concat "#" (match-string-no-properties 1)) match))
 
 (defun rainbow-colorize-by-assoc (assoc-list)
   "Colorize a match with its association from ASSOC-LIST."
-- 
2.34.1