[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d116055 12/28: Fix original-maximum-face restoration bug.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master d116055 12/28: Fix original-maximum-face restoration bug. |
Date: |
Tue, 05 May 2015 11:10:19 +0000 |
branch: master
commit d11605500d0a29ae7718d313469f3ce411979a24
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Fix original-maximum-face restoration bug.
---
context-coloring.el | 6 ++-
test/context-coloring-test.el | 80 ++++++++++++++++++++++------------------
2 files changed, 48 insertions(+), 38 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index c7caa86..2b65666 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -647,7 +647,9 @@ which must already exist and which *should* already be
enabled."
(let* ((properties (gethash theme context-coloring-theme-hash-table))
(colors (plist-get properties :colors))
(level -1))
- (setq context-coloring-maximum-face (- (length colors) 1))
+ ;; Only clobber when we have to.
+ (when (custom-theme-enabled-p theme)
+ (setq context-coloring-maximum-face (- (length colors) 1)))
(apply
'custom-theme-set-faces
theme
@@ -745,7 +747,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
(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) 1)
;; 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 ede72aa..b9de898 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -56,7 +56,10 @@
(setq context-coloring-syntactic-strings nil)
(setq context-coloring-js-block-scopes nil)
(setq context-coloring-colorize-hook nil)
- (setq context-coloring-check-scopifier-version-hook nil))
+ (setq context-coloring-check-scopifier-version-hook nil)
+ (setq context-coloring-maximum-face 7)
+ (setq context-coloring-original-maximum-face
+ context-coloring-maximum-face))
(defmacro context-coloring-test-with-fixture (fixture &rest body)
"With the relative FIXTURE, evaluate BODY in a temporary
@@ -500,12 +503,14 @@ test completes."
(format "context-coloring-test-define-theme-%s" name))))
`(ert-deftest ,deftest-name ()
(context-coloring-test-kill-buffer "*Warnings*")
+ (context-coloring-test-setup)
(let ((theme (context-coloring-test-get-next-theme)))
(unwind-protect
(progn
,@body)
;; Always cleanup.
- (disable-theme theme))))))
+ (disable-theme theme)
+ (context-coloring-test-cleanup))))))
(defun context-coloring-test-deftheme (theme)
"Dynamically define theme THEME."
@@ -671,42 +676,45 @@ see that function."
(append arguments '(t))))
(context-coloring-test-deftest-define-theme disable-cascade
- (context-coloring-test-deftheme theme)
- (context-coloring-define-theme
- theme
- :colors '("#aaaaaa"
- "#bbbbbb"))
- (let ((second-theme (context-coloring-test-get-next-theme)))
- (context-coloring-test-deftheme second-theme)
+ (let ((maximum-face-value 9999))
+ (setq context-coloring-maximum-face maximum-face-value)
+ (context-coloring-test-deftheme theme)
(context-coloring-define-theme
- second-theme
- :colors '("#cccccc"
- "#dddddd"
- "#eeeeee"))
- (let ((third-theme (context-coloring-test-get-next-theme)))
- (context-coloring-test-deftheme third-theme)
+ theme
+ :colors '("#aaaaaa"
+ "#bbbbbb"))
+ (let ((second-theme (context-coloring-test-get-next-theme)))
+ (context-coloring-test-deftheme second-theme)
(context-coloring-define-theme
- third-theme
- :colors '("#111111"
- "#222222"
- "#333333"
- "#444444"))
- (enable-theme theme)
- (enable-theme second-theme)
- (enable-theme third-theme)
- (disable-theme third-theme)
- (context-coloring-test-assert-face 0 "#cccccc")
- (context-coloring-test-assert-face 1 "#dddddd")
- (context-coloring-test-assert-face 2 "#eeeeee")
- (context-coloring-test-assert-maximum-face 2))
- (disable-theme second-theme)
- (context-coloring-test-assert-face 0 "#aaaaaa")
- (context-coloring-test-assert-face 1 "#bbbbbb")
- (context-coloring-test-assert-maximum-face 1))
- (disable-theme theme)
- (context-coloring-test-assert-not-face 0 "#aaaaaa")
- (context-coloring-test-assert-not-face 1 "#bbbbbb")
- (context-coloring-test-assert-not-maximum-face 1))
+ second-theme
+ :colors '("#cccccc"
+ "#dddddd"
+ "#eeeeee"))
+ (let ((third-theme (context-coloring-test-get-next-theme)))
+ (context-coloring-test-deftheme third-theme)
+ (context-coloring-define-theme
+ third-theme
+ :colors '("#111111"
+ "#222222"
+ "#333333"
+ "#444444"))
+ (enable-theme theme)
+ (enable-theme second-theme)
+ (enable-theme third-theme)
+ (disable-theme third-theme)
+ (context-coloring-test-assert-face 0 "#cccccc")
+ (context-coloring-test-assert-face 1 "#dddddd")
+ (context-coloring-test-assert-face 2 "#eeeeee")
+ (context-coloring-test-assert-maximum-face 2))
+ (disable-theme second-theme)
+ (context-coloring-test-assert-face 0 "#aaaaaa")
+ (context-coloring-test-assert-face 1 "#bbbbbb")
+ (context-coloring-test-assert-maximum-face 1))
+ (disable-theme theme)
+ (context-coloring-test-assert-not-face 0 "#aaaaaa")
+ (context-coloring-test-assert-not-face 1 "#bbbbbb")
+ (context-coloring-test-assert-maximum-face
+ maximum-face-value)))
(defun context-coloring-test-js-function-scopes ()
"Test fixtures/functions-scopes.js."
- [elpa] master a7f5970 04/28: Remove unused function., (continued)
- [elpa] master a7f5970 04/28: Remove unused function., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 9873030 08/28: Use real keywords., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 0888e06 01/28: Use Cask and Coveralls., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 202ca74 15/28: Drop `subr-x' dependency., Jackson Ray Hamilton, 2015/05/05
- [elpa] master dd3fe3c 06/28: Fix badges., Jackson Ray Hamilton, 2015/05/05
- [elpa] master fb53884 17/28: Update README., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 52da59c 18/28: Bust cache., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 3f63fab 11/28: Add local coverage configuration., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 158fd83 16/28: Test the trimming function., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 0c20edf 14/28: Add coverage for missing lines., Jackson Ray Hamilton, 2015/05/05
- [elpa] master d116055 12/28: Fix original-maximum-face restoration bug.,
Jackson Ray Hamilton <=
- [elpa] master 1b6f6fb 21/28: Cleanup README., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 5dd3035 19/28: Refactor trim functions., Jackson Ray Hamilton, 2015/05/05
- [elpa] master f8cfd37 22/28: Double-space., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 64852e7 24/28: Update library headers., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 55ca15a 23/28: Guard against excessively lenghty nodes., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 8f1af4a 20/28: Update library header., Jackson Ray Hamilton, 2015/05/05
- [elpa] master dbddc45 26/28: Reimplement coverage reporter in elisp., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 6ee3f82 25/28: Refactor coverage., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 283a006 27/28: Version 6.2.1., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 8a083d5 28/28: Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' from context-coloring, Jackson Ray Hamilton, 2015/05/05