[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e451d29 06/26: Restore original `context-coloring-maximum-
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master e451d29 06/26: Restore original `context-coloring-maximum-face' value. |
Date: |
Sat, 14 Feb 2015 08:19:33 +0000 |
branch: master
commit e451d293e3b411b8647bf893bb4a04012c18ae76
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Restore original `context-coloring-maximum-face' value.
---
context-coloring.el | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index f069e95..fbc49b8 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -137,7 +137,9 @@ and DARK backgrounds."
(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-maximum-face 7)
+ (setq context-coloring-original-maximum-face
+ context-coloring-maximum-face))
(context-coloring-set-colors-default)
@@ -160,6 +162,8 @@ and DARK backgrounds."
"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.
@@ -659,12 +663,20 @@ THEME."
(context-coloring-warn-theme-originally-set theme))
(context-coloring-apply-theme theme))))))
+(defvar context-coloring-original-maximum-face nil
+ "Value for `context-coloring-maximum-face' to fall back to
+ when all themes have been disabled.")
+
(defadvice enable-theme (after context-coloring-enable-theme (theme) activate)
"Enable colors for context themes just-in-time. We can't set
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)
+ ;; Cache because we can't reliably figure it out in reverse.
+ (setq context-coloring-original-maximum-face
+ context-coloring-maximum-face))
(context-coloring-enable-theme theme)))
(defadvice disable-theme (after context-coloring-disable-theme (theme)
activate)
@@ -674,10 +686,10 @@ faces for custom themes that might not exist yet."
(let ((enabled-theme (car custom-enabled-themes)))
(if (context-coloring-theme-p enabled-theme)
(context-coloring-enable-theme enabled-theme)
- ;; TODO: This kinda works, though it overrides user-defined colors, so
- ;; we should figure out the highest level deffaced face instead and set
- ;; the `context-coloring-level-count' to that face's level.
- (context-coloring-set-colors-default)))))
+ ;; Assume we are back to no theme; act as if nothing ever happened.
+ ;; This is still prone to intervention, but rather extraordinarily.
+ (setq context-coloring-maximum-face
+ context-coloring-original-maximum-face)))))
(context-coloring-define-theme
'ample
- [elpa] master updated (3b749e8 -> f52a5e5), Jackson Ray Hamilton, 2015/02/14
- [elpa] master 75e624c 01/26: Todo., Jackson Ray Hamilton, 2015/02/14
- [elpa] master bd11b35 03/26: Avoid using the `font-lock-string-face' color for zenburn., Jackson Ray Hamilton, 2015/02/14
- [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 <=
- [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, 2015/02/14
- [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