Skip to content

Commit

Permalink
rainbow: add font-lock at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
jd committed Oct 12, 2015
1 parent cb47e83 commit 1ef059c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions rainbow-mode.el
Expand Up @@ -4,7 +4,7 @@

;; Author: Julien Danjou <julien@danjou.info>
;; Keywords: faces
;; Version: 0.11
;; Version: 0.12

;; This file is part of GNU Emacs.

Expand Down Expand Up @@ -1104,25 +1104,29 @@ Return a value between 0 and 1."
(defun rainbow-turn-on ()
"Turn on raibow-mode."
(font-lock-add-keywords nil
rainbow-hexadecimal-colors-font-lock-keywords)
rainbow-hexadecimal-colors-font-lock-keywords
t)
;; Activate X colors?
(when (or (eq rainbow-x-colors t)
(and (eq rainbow-x-colors 'auto)
(memq major-mode rainbow-x-colors-major-mode-list)))
(font-lock-add-keywords nil
rainbow-x-colors-font-lock-keywords))
rainbow-x-colors-font-lock-keywords
t))
;; Activate LaTeX colors?
(when (or (eq rainbow-latex-colors t)
(and (eq rainbow-latex-colors 'auto)
(memq major-mode rainbow-latex-colors-major-mode-list)))
(font-lock-add-keywords nil
rainbow-latex-rgb-colors-font-lock-keywords))
rainbow-latex-rgb-colors-font-lock-keywords
t))
;; Activate ANSI colors?
(when (or (eq rainbow-ansi-colors t)
(and (eq rainbow-ansi-colors 'auto)
(memq major-mode rainbow-ansi-colors-major-mode-list)))
(font-lock-add-keywords nil
rainbow-ansi-colors-font-lock-keywords))
rainbow-ansi-colors-font-lock-keywords
t))
;; Activate HTML colors?
(when (or (eq rainbow-html-colors t)
(and (eq rainbow-html-colors 'auto)
Expand All @@ -1132,7 +1136,8 @@ Return a value between 0 and 1."
(0 (rainbow-colorize-by-assoc rainbow-html-colors-alist)))))
(font-lock-add-keywords nil
`(,@rainbow-html-colors-font-lock-keywords
,@rainbow-html-rgb-colors-font-lock-keywords)))
,@rainbow-html-rgb-colors-font-lock-keywords)
t))
;; Activate R colors?
(when (or (eq rainbow-r-colors t)
(and (eq rainbow-r-colors 'auto)
Expand All @@ -1142,7 +1147,7 @@ Return a value between 0 and 1."
(0 (rainbow-colorize-by-assoc rainbow-r-colors-alist)))))
(font-lock-add-keywords nil
rainbow-r-colors-font-lock-keywords
)))
t)))

(defun rainbow-turn-off ()
"Turn off rainbow-mode."
Expand Down

0 comments on commit 1ef059c

Please sign in to comment.