[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/colorful-mode 73c6e26d7b: Minor changes.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/colorful-mode 73c6e26d7b: Minor changes. |
Date: |
Sun, 16 Mar 2025 18:58:05 -0400 (EDT) |
branch: externals/colorful-mode
commit 73c6e26d7b823a5e872195cbcd320e24674d8f94
Author: Elías Gabriel Pérez <eg642616@gmail.com>
Commit: Elías Gabriel Pérez <eg642616@gmail.com>
Minor changes.
* README.org: Update sample code.
* colorful-mode.el (colorful--hex-to-name, colorful--find-overlay):
Use `cl-dolist' instead `catch throw'
---
README.org | 19 +++++++++++--------
colorful-mode.el | 14 ++++++--------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/README.org b/README.org
index 970755474e..2e00ad06ad 100644
--- a/README.org
+++ b/README.org
@@ -204,18 +204,21 @@ for you:
(add-hook 'post-command-hook
(lambda ()
"delete colorful overlay on active mark"
- (when colorful-mode
- (if-let* ((beg (use-region-beginning))
+ (when-let* (colorful-mode
+ (beg (use-region-beginning))
(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)))
- (save-excursion
- (and (mark)
- (font-lock-fontify-region
- (region-beginning)
- (region-end))))))))
+ 'colorful--overlay t))))))
+
+(add-hook 'deactivate-mark-hook
+ (lambda ()
+ "refontify deleted mark"
+ (when-let* (colorful-mode
+ (beg (region-beginning))
+ (end (region-end)))
+ (font-lock-flush beg end))))
#+end_src
* How does it compare to =rainbow-mode= or built-in =css fontify colors=?
diff --git a/colorful-mode.el b/colorful-mode.el
index be645bf257..4bb7e86880 100644
--- a/colorful-mode.el
+++ b/colorful-mode.el
@@ -476,10 +476,9 @@ H must be a float not divided."
(defun colorful--hex-to-name (hex)
"Return HEX as color name."
- (catch 'name
- (dolist (color-list color-name-rgb-alist)
- (if (equal (cdr color-list) (color-values hex))
- (throw 'name (car color-list))))))
+ (cl-dolist (color-list color-name-rgb-alist)
+ (if (equal (cdr color-list) (color-values hex))
+ (cl-return (car color-list)))))
(defun colorful--name-to-hex (name)
"Return color NAME as hex color format."
@@ -492,10 +491,9 @@ H must be a float not divided."
(defun colorful--find-overlay (&optional beg)
"Return colorful overlay if found at current point.
BEG is the position to check for the overlay."
- (catch 'val
- (dolist (ov (overlays-at (or beg (point))))
- (if (overlay-get ov 'colorful--overlay)
- (throw 'val ov)))))
+ (cl-dolist (ov (overlays-at (or beg (point))))
+ (if (overlay-get ov 'colorful--overlay)
+ (cl-return ov))))
(defun colorful--delete-overlays (limit)
"Font-lock matcher that flushes our overlays before we install new ones."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/colorful-mode 73c6e26d7b: Minor changes.,
ELPA Syncer <=