branch: externals/colorful-mode
commit e5bfed612003eb30df5d83212f855aca54e31609
Author: Elías Gabriel Pérez <[email protected]>
Commit: Elías Gabriel Pérez <[email protected]>

    Use `rassoc' in colorful--hex-to-name instead `cl-dolist'
    
    * README.org (Disable colorful in regions): Update sample code.
    * colorful-mode.el (colorful--hex-to-name): Use `rassoc'.
    * test/css.css: Remove some tests.
---
 README.org       | 3 +--
 colorful-mode.el | 4 +---
 test/css.css     | 6 +-----
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index 2e00ad06ad..43cc282faf 100644
--- a/README.org
+++ b/README.org
@@ -209,8 +209,7 @@ for you:
                         (end (use-region-end)))
                   (dolist (ov (overlays-in beg end))
                     (when (overlay-get ov 'colorful--overlay)
-                      (remove-overlays (overlay-start ov) (overlay-end ov)
-                                       'colorful--overlay t))))))
+                      (remove-overlays beg end 'colorful--overlay t))))))
 
 (add-hook 'deactivate-mark-hook
           (lambda ()
diff --git a/colorful-mode.el b/colorful-mode.el
index 4bb7e86880..e554a5b7ad 100644
--- a/colorful-mode.el
+++ b/colorful-mode.el
@@ -476,9 +476,7 @@ H must be a float not divided."
 
 (defun colorful--hex-to-name (hex)
   "Return HEX as color name."
-  (cl-dolist (color-list color-name-rgb-alist)
-    (if (equal (cdr color-list) (color-values hex))
-        (cl-return (car color-list)))))
+  (car (rassoc (color-values hex) color-name-rgb-alist)))
 
 (defun colorful--name-to-hex (name)
   "Return color NAME as hex color format."
diff --git a/test/css.css b/test/css.css
index 7770046576..d40fe29de2 100644
--- a/test/css.css
+++ b/test/css.css
@@ -13,12 +13,8 @@
 --function-color-2: var(--function-color-1); /* #b5e1ff */
 
 --color: #ffff00; /* yellow */
-
-@define_color  base_color  #ff0000; /* red */
-@define_color  highlight_color  blue;
-
 @define_color  base_color  rgb(255, 0, 0); /* red */
-@define_color  highlight_color  rgb(0, 0, 255); /* blue */
+@define_color  highlight_color  blue;
 
 vars
 {

Reply via email to