[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 0681e94 13/26: Remove `set-colors' and `set-colors-default
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 0681e94 13/26: Remove `set-colors' and `set-colors-default'. |
Date: |
Sat, 14 Feb 2015 08:19:36 +0000 |
branch: master
commit 0681e9463b4d826977a97b7f1ece9fac2aa9fb0f
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Remove `set-colors' and `set-colors-default'.
---
context-coloring.el | 51 ++++++++++++++--------------------------
test/context-coloring-test.el | 32 +------------------------
2 files changed, 20 insertions(+), 63 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 5d18157..341efe8 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -85,24 +85,23 @@ and DARK backgrounds."
"Define a face for LEVEL with the default neutral colors."
(context-coloring-defface level nil "#3f3f3f" "#cdcdcd"))
-(defun context-coloring-set-colors-default ()
- (context-coloring-defface 0 nil "#000000" "#ffffff")
- (context-coloring-defface 1 "yellow" "#007f80" "#ffff80")
- (context-coloring-defface 2 "green" "#001580" "#cdfacd")
- (context-coloring-defface 3 "cyan" "#550080" "#d8d8ff")
- (context-coloring-defface 4 "blue" "#802b00" "#e7c7ff")
- (context-coloring-defface 5 "magenta" "#6a8000" "#ffcdcd")
- (context-coloring-defface 6 "red" "#008000" "#ffe390")
- (context-coloring-defface-default 7)
- (setq context-coloring-maximum-face 7)
- (setq context-coloring-original-maximum-face
- context-coloring-maximum-face)
- ;; Theme authors can have up to 26 levels: 1 (0th) for globals, 24 (1st-24th)
- ;; for in-betweens, and 1 (25th) for infinity.
- (dotimes (number 18)
- (context-coloring-defface-default (+ number context-coloring-maximum-face
1))))
-
-(context-coloring-set-colors-default)
+(context-coloring-defface 0 nil "#000000" "#ffffff")
+(context-coloring-defface 1 "yellow" "#007f80" "#ffff80")
+(context-coloring-defface 2 "green" "#001580" "#cdfacd")
+(context-coloring-defface 3 "cyan" "#550080" "#d8d8ff")
+(context-coloring-defface 4 "blue" "#802b00" "#e7c7ff")
+(context-coloring-defface 5 "magenta" "#6a8000" "#ffcdcd")
+(context-coloring-defface 6 "red" "#008000" "#ffe390")
+(context-coloring-defface-default 7)
+
+(setq context-coloring-maximum-face 7)
+(setq context-coloring-original-maximum-face
+ context-coloring-maximum-face)
+
+;; Theme authors can have up to 26 levels: 1 (0th) for globals, 24 (1st-24th)
+;; for in-betweens, and 1 (25th) for infinity.
+(dotimes (number 18)
+ (context-coloring-defface-default (+ number context-coloring-maximum-face
1)))
;;; Face functions
@@ -114,20 +113,6 @@ and DARK backgrounds."
(number-to-string level)
"-face")))
-(defun context-coloring-set-colors (&rest colors)
- "Set context coloring's levels' coloring to COLORS, where the
-Nth element of COLORS is level N's color."
- (setq context-coloring-maximum-face (- (length colors) 1))
- (setq context-coloring-original-maximum-face
- context-coloring-maximum-face)
- (let ((level 0))
- (dolist (color colors)
- ;; Ensure there are available faces to contain new colors.
- (when (not (context-coloring-face-symbol level))
- (context-coloring-defface-default level))
- (set-face-foreground (context-coloring-face-symbol level) color)
- (setq level (+ level 1)))))
-
(defsubst context-coloring-level-face (level)
"Returns the face name for LEVEL."
(context-coloring-face-symbol (min level context-coloring-maximum-face)))
@@ -658,7 +643,7 @@ faces for custom themes that might not exist yet."
(when (and (not (eq theme 'user)) ; Called internally by `enable-theme'.
(custom-theme-p theme) ; Guard against non-existent themes.
(context-coloring-theme-p theme))
- (when (> (length custom-enabled-themes) 0)
+ (when (= (length custom-enabled-themes) 0)
;; Cache because we can't reliably figure it out in reverse.
(setq context-coloring-original-maximum-face
context-coloring-maximum-face))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 7c23d89..61e24b1 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -42,8 +42,7 @@
"Cleanup code to run after all tests."
(setq context-coloring-comments-and-strings t)
(setq context-coloring-after-colorize-hook nil)
- (setq context-coloring-js-block-scopes nil)
- (context-coloring-set-colors-default))
+ (setq context-coloring-js-block-scopes nil))
(defmacro context-coloring-test-with-fixture (fixture &rest body)
"Evaluate BODY in a temporary buffer with the relative
@@ -286,32 +285,6 @@ FOREGROUND."
"Context coloring is not available for this major mode"
"*Messages*")))
-(ert-deftest context-coloring-test-set-colors ()
- ;; This test has an irreversible side-effect in that it defines faces beyond
- ;; 7. Faces 0 through 7 are reset to their default states, so it might not
- ;; matter, but be aware anyway.
- (context-coloring-set-colors
- "#000000"
- "#111111"
- "#222222"
- "#333333"
- "#444444"
- "#555555"
- "#666666"
- "#777777"
- "#888888"
- "#999999")
- (context-coloring-test-assert-face 0 "#000000")
- (context-coloring-test-assert-face 1 "#111111")
- (context-coloring-test-assert-face 2 "#222222")
- (context-coloring-test-assert-face 3 "#333333")
- (context-coloring-test-assert-face 4 "#444444")
- (context-coloring-test-assert-face 5 "#555555")
- (context-coloring-test-assert-face 6 "#666666")
- (context-coloring-test-assert-face 7 "#777777")
- (context-coloring-test-assert-face 8 "#888888")
- (context-coloring-test-assert-face 9 "#999999"))
-
(defvar context-coloring-test-theme-index 0
"Unique index for unique theme names.")
@@ -417,8 +390,7 @@ themes are reversed after the test completes."
(progn
,@body)
;; Always cleanup.
- (disable-theme theme)
- (context-coloring-set-colors-default))))))
+ (disable-theme theme))))))
(defun context-coloring-test-deftheme (theme)
"Dynamically define theme THEME."
- [elpa] master ebbc2f1 04/26: Fix documentation for `context-coloring-maximum-face'., (continued)
- [elpa] master ebbc2f1 04/26: Fix documentation for `context-coloring-maximum-face'., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 62c38d8 05/26: Fix comment., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 880ab8a 02/26: Use `maximum-face' instead of `face-count'., Jackson Ray Hamilton, 2015/02/14
- [elpa] master e451d29 06/26: Restore original `context-coloring-maximum-face' value., Jackson Ray Hamilton, 2015/02/14
- [elpa] master a1b7f3e 08/26: Define extra faces in `context-coloring-set-colors-default'., Jackson Ray Hamilton, 2015/02/14
- [elpa] master ca15a60 09/26: Whitespace., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 351142e 07/26: More disciplined use of `if'., Jackson Ray Hamilton, 2015/02/14
- [elpa] master e68d00b 11/26: Whitespace., Jackson Ray Hamilton, 2015/02/14
- [elpa] master c125d9f 12/26: Reorganize defvars and defcustoms., Jackson Ray Hamilton, 2015/02/14
- [elpa] master a49b024 15/26: Whitespace., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 0681e94 13/26: Remove `set-colors' and `set-colors-default'.,
Jackson Ray Hamilton <=
- [elpa] master e5d512f 10/26: "Misfeature.", Jackson Ray Hamilton, 2015/02/14
- [elpa] master 25a8d13 16/26: Documentation., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 4c3d1da 17/26: Rename `defface-default' to `defface-neutral'., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 8367e19 18/26: Rename `level-face' functions., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 3d91840 22/26: Remove `context-coloring-benchmark-colorization'., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 3805110 14/26: Reorganize faces. Remove eval macroexpand., Jackson Ray Hamilton, 2015/02/14
- [elpa] master a7db850 20/26: Cleanup documentation., Jackson Ray Hamilton, 2015/02/14
- [elpa] master bae456d 19/26: Use imperative for documentation., Jackson Ray Hamilton, 2015/02/14
- [elpa] master 45c0d1a 23/26: Add `:setup' and `:teardown' properties to dispatches., Jackson Ray Hamilton, 2015/02/14
- [elpa] master f4e1cbc 25/26: Version 6.0.0., Jackson Ray Hamilton, 2015/02/14