[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rainbow-mode d78fc41 03/26: rainbow-mode 0.3
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rainbow-mode d78fc41 03/26: rainbow-mode 0.3 |
Date: |
Tue, 1 Dec 2020 16:53:18 -0500 (EST) |
branch: externals/rainbow-mode
commit d78fc415106ff2b217051c7be7ce456407dec9b4
Author: Julien Danjou <julien@danjou.info>
Commit: Julien Danjou <julien@danjou.info>
rainbow-mode 0.3
* rainbow-mode.el: avoid colorizing HTML entities
---
rainbow-mode.el | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/rainbow-mode.el b/rainbow-mode.el
index d3b759c..3cf6c11 100644
--- a/rainbow-mode.el
+++ b/rainbow-mode.el
@@ -1,10 +1,10 @@
;;; rainbow-mode.el --- Colorize color names in buffers
-;; Copyright (C) 2010-2011 Free Software Foundation, Inc
+;; Copyright (C) 2010-2012 Free Software Foundation, Inc
;; Author: Julien Danjou <julien@danjou.info>
;; Keywords: faces
-;; Version: 0.2
+;; Version: 0.3
;; This file is part of GNU Emacs.
@@ -42,14 +42,16 @@
;; Hexadecimal colors
(defvar rainbow-hexadecimal-colors-font-lock-keywords
- '(("#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}"
+ '(("[^&]\\(#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}\\)"
+ (1 (rainbow-colorize-itself 1)))
+ ("^\\(#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}\\)"
(0 (rainbow-colorize-itself)))
("[Rr][Gg][Bb]:[0-9a-fA-F]\\{1,4\\}/[0-9a-fA-F]\\{1,4\\}/[0-9a-fA-F]\\{1,4\\}"
(0 (rainbow-colorize-itself)))
("[Rr][Gg][Bb][Ii]:[0-9.]+/[0-9.]+/[0-9.]+"
(0 (rainbow-colorize-itself)))
-
("\\(?:[Cc][Ii][Ee]\\(?:[Xx][Yy][Zz]\\|[Uu][Vv][Yy]\\|[Xx][Yy][Yy]\\|[Ll][Aa][Bb]\\|[Ll][Uu][Vv]\\)\\|[Tt][Ee][Kk][Hh][Vv][Cc]\\):[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?"
- (0 (rainbow-colorize-itself))))
+
("\\(?:[Cc][Ii][Ee]\\(?:[Xx][Yy][Zz]\\|[Uu][Vv][Yy]\\|[Xx][Yy][Yy]\\|[Ll][Aa][Bb]\\|[Ll][Uu][Vv]\\)\\|[Tt][Ee][Kk][Hh][Vv][Cc]\\):[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?")
+ (0 (rainbow-colorize-itself)))
"Font-lock keywords to add for hexadecimal colors.")
;; rgb() colors
@@ -280,19 +282,20 @@ will be enabled if a major mode has been detected from the
:group 'rainbow)
;; Functions
-(defun rainbow-colorize-match (color)
+(defun rainbow-colorize-match (color &optional match)
"Return a matched string propertized with a face whose
background is COLOR. The foreground is computed using
`rainbow-color-luminance', and is either white or black."
- (put-text-property
- (match-beginning 0) (match-end 0)
- 'face `((:foreground ,(if (> 0.5 (rainbow-x-color-luminance color))
- "white" "black"))
- (:background ,color))))
-
-(defun rainbow-colorize-itself ()
+ (let ((match (or match 0)))
+ (put-text-property
+ (match-beginning match) (match-end match)
+ 'face `((:foreground ,(if (> 0.5 (rainbow-x-color-luminance color))
+ "white" "black"))
+ (:background ,color)))))
+
+(defun rainbow-colorize-itself (&optional match)
"Colorize a match with itself."
- (rainbow-colorize-match (match-string-no-properties 0)))
+ (rainbow-colorize-match (match-string-no-properties (or match 0)) match))
(defun rainbow-colorize-hexadecimal-without-sharp ()
"Colorize an hexadecimal colors and prepend # to it."
- [elpa] branch externals/rainbow-mode created (now 347bd20), Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode d78fc41 03/26: rainbow-mode 0.3,
Stefan Monnier <=
- [elpa] externals/rainbow-mode 1d90a91 05/26: rainbow-mode: version 0.5, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 83bb7be 06/26: rainbow-mode: fix some LaTex docstrings, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode ea74dbb 01/26: Give every package its own directory in packages/, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 47c6ac1 04/26: rainbow-mode: version 0.4, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 65948a4 07/26: * rainbow-mode: update to 0.6, add support for ANSI coloring, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode bcc2bcd 10/26: rainbow-mode: 0.9, allow spaces in LaTeX colors, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode cb47e83 13/26: rainbow: fix font-lock-mode refresh, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 3e5d506 19/26: rainbow-mode: release 1.0, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 313f105 15/26: Fix `rainbow-color-luminance' docstring, Stefan Monnier, 2020/12/01
- [elpa] externals/rainbow-mode 4cfdc5b 18/26: Allow outline-minor-mode to find section headings, Stefan Monnier, 2020/12/01