[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rainbow-mode 6ca3ad0 23/26: Release rainbow-mode 1.0.3
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rainbow-mode 6ca3ad0 23/26: Release rainbow-mode 1.0.3 |
Date: |
Tue, 1 Dec 2020 16:53:22 -0500 (EST) |
branch: externals/rainbow-mode
commit 6ca3ad0ad84801fbdb2b2524ea6379e900070066
Author: Julien Danjou <julien@danjou.info>
Commit: Julien Danjou <julien@danjou.info>
Release rainbow-mode 1.0.3
* Use cl-lib instead of cl
As of Emacs 27.1 `cl' is officially deprecated.
`cl' was only required for `multiple-value-bind' and using that was
conceptually wrong to begin with: `color-hsl-to-rgb' does NOT return three
values; it returns one value which happens to consist of three components
and
any one of these components by itself is meaningless. Now we use
`cl-destructuring-bind', which does not have the same connotation.
* rainbow-keywords-hook: New hook run by rainbow-mode
* rainbow-mode: Remove unnecessary progn
Also improve a contained comment.
Thanks Jonas Bernoulli <jonas@bernoul.li>
---
rainbow-mode.el | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/rainbow-mode.el b/rainbow-mode.el
index 653e166..f49de88 100644
--- a/rainbow-mode.el
+++ b/rainbow-mode.el
@@ -1,10 +1,10 @@
;;; rainbow-mode.el --- Colorize color names in buffers
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc
;; Author: Julien Danjou <julien@danjou.info>
;; Keywords: faces
-;; Version: 1.0.2
+;; Version: 1.0.3
;; This file is part of GNU Emacs.
@@ -29,9 +29,7 @@
;;; Code:
-(eval-when-compile
- (require 'cl))
-
+(require 'cl-lib)
(require 'regexp-opt)
(require 'faces)
(require 'color)
@@ -1060,7 +1058,7 @@ If the percentage value is above 100, it's converted to
100."
(s (/ (string-to-number (match-string-no-properties 2)) 100.0))
(l (/ (string-to-number (match-string-no-properties 3)) 100.0)))
(rainbow-colorize-match
- (multiple-value-bind (r g b)
+ (cl-destructuring-bind (r g b)
(color-hsl-to-rgb h s l)
(format "#%02X%02X%02X" (* r 255) (* g 255) (* b 255))))))
@@ -1190,17 +1188,27 @@ Return a value between 0 and 1."
,@rainbow-html-colors-font-lock-keywords
,@rainbow-html-rgb-colors-font-lock-keywords)))
+(defvar rainbow-keywords-hook nil
+ "Hook used to add additional font-lock keywords.
+This hook is called by `rainbow-mode' before it re-enables
+`font-lock-mode'. Hook functions must only add additional
+keywords when `rainbow-mode' is non-nil. When that is nil,
+then they must remove those additional keywords again.")
+
;;;###autoload
(define-minor-mode rainbow-mode
"Colorize strings that represent colors.
This will fontify with colors the string like \"#aabbcc\" or \"blue\"."
:lighter " Rbow"
- (progn
- (if rainbow-mode
- (rainbow-turn-on)
- (rainbow-turn-off))
- ;; Call font-lock-mode to refresh the buffer when used e.g. interactively
- (font-lock-mode 1)))
+ (if rainbow-mode
+ (rainbow-turn-on)
+ (rainbow-turn-off))
+ ;; We cannot use `rainbow-mode-hook' because this has
+ ;; to be done before `font-lock-mode' is re-enabled.
+ (run-hooks 'rainbow-keywords-hook)
+ ;; Call `font-lock-mode' to refresh the buffer when used
+ ;; e.g. interactively.
+ (font-lock-mode 1))
(provide 'rainbow-mode)
- [elpa] externals/rainbow-mode 1f37950 02/26: Update rainbow-mode to version 0.2, (continued)
- [elpa] externals/rainbow-mode 1f37950 02/26: Update rainbow-mode to version 0.2, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 3a684c7 09/26: rainbow-mode: add support for R, bump version to 0.8, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 16afb8a 08/26: rainbow-mode: version 0.7, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode fb7c982 20/26: * rainbow-mode/rainbow-mode.el: do not fail if face-property is a symbol, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 3239d63 11/26: rainbow-mode: support float in CSS and limit to 100%, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 9129350 12/26: * packages/rainbow-mode/rainbow-mode.el (ansi-color-context), Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 1ef059c 14/26: rainbow: add font-lock at the end, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode c9c1728 16/26: Enforce use of spaces for indentation, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 3a5a7aa 25/26: fix(rainbow_mode): remove spurious + in regex, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 011bf53 22/26: Release rainbow-mode 1.0.2, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 6ca3ad0 23/26: Release rainbow-mode 1.0.3,
Stefan Monnier <=
- [elpa] externals/rainbow-mode 347bd20 26/26: * .gitignore: New file, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 5b611d9 17/26: Set type of customizable options, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 54ac3d5 24/26: fix(rainbow-mode): fix typo in docstring, Stefan Monnier, 2020/12/01