[elpa] master e451d29 06/26: Restore original `context-coloring-maximum-face' value.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit e451d293e3b411b8647bf893bb4a04012c18ae76
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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 880ab8a 02/26: Use `maximum-face' instead of `face-count'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 880ab8a09dc64a07fdf32caeef8e3677de20fc38
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Use `maximum-face' instead of `face-count'.
---
 context-coloring.el   |   18 +-
 test/context-coloring-test.el |   24 
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ce2e7aa..89bbfc3 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -121,7 +121,7 @@ and DARK backgrounds."
  ,doc
  :group 'context-coloring)
 
-(defvar context-coloring-face-count nil
+(defvar context-coloring-maximum-face nil
   "Number of faces available for coloring.")
 
 (defun context-coloring-defface-default (level)
@@ -137,14 +137,14 @@ 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-face-count 8))
+  (setq context-coloring-maximum-face 7))
 
 (context-coloring-set-colors-default)
 
 ;; Color 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-face-count)))
+  (context-coloring-defface-default (+ number context-coloring-maximum-face 
1)))
 
 
 ;;; Face functions
@@ -159,7 +159,7 @@ and DARK backgrounds."
 (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-face-count (length colors))
+  (setq context-coloring-maximum-face (- (length colors) 1))
   (let ((level 0))
 (dolist (color colors)
   ;; Ensure there are available faces to contain new colors.
@@ -170,7 +170,7 @@ Nth element of COLORS is level N's color."
 
 (defsubst context-coloring-level-face (level)
   "Returns the face name for LEVEL."
-  (context-coloring-face-symbol (min level context-coloring-face-count)))
+  (context-coloring-face-symbol (min level context-coloring-maximum-face)))
 
 
 ;;; Colorization utilities
@@ -565,7 +565,7 @@ 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-face-count (length colors))
+(setq context-coloring-maximum-face (- (length colors) 1))
 (apply
  'custom-theme-set-faces
  theme
@@ -629,7 +629,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
 
 (defun context-coloring-enable-theme (theme)
   "Applies THEME if its colors are not already set, else just
-sets `context-coloring-face-count' to the correct value for
+sets `context-coloring-maximum-face' to the correct value for
 THEME."
   (let* ((properties (gethash theme context-coloring-theme-hash-table))
  (recede (plist-get properties :recede))
@@ -641,7 +641,7 @@ THEME."
  ;; This can be true whether originally set by a custom theme or by a
  ;; context theme.
  ((> highest-level -1)
-  (setq context-coloring-face-count (+ highest-level 1)))
+  (setq context-coloring-maximum-face highest-level))
  ;; It is possible that the corresponding custom theme did not exist at
  ;; the time of defining this context theme, and in that case the above
  ;; condition proves the custom theme did not originally set any faces,
@@ -669,7 +669,7 @@ faces for custom themes that might not exist yet."
 
 (defadvice disable-theme (after context-coloring-disable-theme (theme) 
activate)
   "Colors are disabled normally, but
-`context-coloring-face-count' isn't.  Update it here."
+`context-coloring-maximum-face' isn't.  Update it here."
   (when (custom-theme-p theme) ; Guard against non-existent themes.
 (let ((enabled-theme (car custom-enabled-themes)))
   (if (context-coloring-theme-p enabled-theme)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index fdb0d83..87568fe 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -563,21 +563,21 @@ theme THEME is signaled."
   (context-coloring-test-assert-face 0 "#aa")
   (context-coloring-test-assert-face 1 "#bb"))
 
-(defun context-coloring-test-assert-face-count (count &optional negate)
-  "Assert that `context-coloring-face-count' is COUNT."
+(defun context-coloring-test-assert-maximum-face (maximum &optional negate)
+  "Assert that `context-coloring-maximum-face' is MAXIMUM."
   (when (funcall (if negate 'identity 'not)
- (eq context-coloring-face-count count))
-(ert-fail (format (concat "Expected `context-coloring-face-count' "
+ (eq context-coloring-maximum-face maximum))
+(ert-fail (format (concat "Expected `context-coloring-maximum-face' "
   

[elpa] master 4c3d1da 17/26: Rename `defface-default' to `defface-neutral'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 4c3d1da27e1ebf239691dc6342ec66ef13b53d92
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Rename `defface-default' to `defface-neutral'.
---
 context-coloring.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 838d055..8b056a5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -77,7 +77,7 @@ backgrounds."
  doc
  :group 'context-coloring)))
 
-(defun context-coloring-defface-default (level)
+(defun context-coloring-defface-neutral (level)
   "Define a face for LEVEL with the default neutral colors."
   (context-coloring-defface level nil "#3f3f3f" "#cdcdcd"))
 
@@ -88,7 +88,7 @@ backgrounds."
 (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)
+(context-coloring-defface-neutral 7)
 
 (defvar context-coloring-maximum-face nil
   "Index of the highest face available for coloring.")
@@ -105,7 +105,7 @@ backgrounds."
 ;; Theme authors can have up to 26 levels: 1 (0th) for globals, 24 (1st-24th)
 ;; for nested levels, and 1 (25th) for infinity.
 (dotimes (number 18)
-  (context-coloring-defface-default (+ number context-coloring-maximum-face 
1)))
+  (context-coloring-defface-neutral (+ number context-coloring-maximum-face 
1)))
 
 
 ;;; Face functions



[elpa] master f4e1cbc 25/26: Version 6.0.0.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit f4e1cbc5386fbf197ff8bcb6a9275f17c9cbe8e4
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Version 6.0.0.
---
 context-coloring.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 574f0bc..849d392 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -5,7 +5,7 @@
 ;; Author: Jackson Ray Hamilton 
 ;; URL: https://github.com/jacksonrayhamilton/context-coloring
 ;; Keywords: context coloring syntax highlighting
-;; Version: 5.0.0
+;; Version: 6.0.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.



[elpa] master 25a8d13 16/26: Documentation.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 25a8d136c3a9fa6cc5557d21b2a5a7d5ea3f1f64
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Documentation.
---
 context-coloring.el |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 9d33b59..838d055 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -65,8 +65,8 @@
 ;;; Faces
 
 (defun context-coloring-defface (level tty light dark)
-  "Dynamically define a face for LEVEL with colors for TTY, LIGHT
-and DARK backgrounds."
+  "Define a face for LEVEL with colors for TTY, LIGHT and DARK
+backgrounds."
   (let ((face (intern (format "context-coloring-level-%s-face" level)))
 (doc (format "Context coloring face, level %s." level)))
 (custom-declare-face
@@ -91,11 +91,11 @@ and DARK backgrounds."
 (context-coloring-defface-default 7)
 
 (defvar context-coloring-maximum-face nil
-  "The highest face available for coloring.")
+  "Index of the highest face available for coloring.")
 
 (defvar context-coloring-original-maximum-face nil
-  "Value for `context-coloring-maximum-face' to fall back to
-  when all themes have been disabled.")
+  "Fallback value for `context-coloring-maximum-face' when all
+  themes have been disabled.")
 
 (setq context-coloring-maximum-face 7)
 



[elpa] master a1b7f3e 08/26: Define extra faces in `context-coloring-set-colors-default'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit a1b7f3eabe79d91e682c5476cf6a478e50d33ef8
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Define extra faces in `context-coloring-set-colors-default'.
---
 context-coloring.el |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 076575c..6658411 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -139,14 +139,14 @@ and DARK backgrounds."
   (context-coloring-defface-default 7)
   (setq context-coloring-maximum-face 7)
   (setq context-coloring-original-maximum-face
-context-coloring-maximum-face))
+context-coloring-maximum-face)
 
-(context-coloring-set-colors-default)
+  ;; 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
 
-;; 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)
 
 
 ;;; Face functions



[elpa] master bae456d 19/26: Use imperative for documentation.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit bae456d654034ee98e6a8a7e023adfb4fd4cb5ea
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Use imperative for documentation.
---
 context-coloring.el |  102 +++---
 1 files changed, 47 insertions(+), 55 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 6c71180..ae7684d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -125,8 +125,8 @@ backgrounds."
 ;;; Colorization utilities
 
 (defsubst context-coloring-colorize-region (start end level)
-  "Colorizes characters from the 1-indexed START (inclusive) to
-END (exclusive) with the face corresponding to LEVEL."
+  "Color characters from the 1-indexed START point (inclusive) to
+the END point (exclusive) with the face corresponding to LEVEL."
   (add-text-properties
start
end
@@ -137,7 +137,7 @@ END (exclusive) with the face corresponding to LEVEL."
   :group 'context-coloring)
 
 (defsubst context-coloring-maybe-colorize-comments-and-strings ()
-  "Colorizes the current buffer's comments and strings if
+  "Color the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
   (when context-coloring-comments-and-strings
 (save-excursion
@@ -147,20 +147,20 @@ END (exclusive) with the face corresponding to LEVEL."
 ;;; js2-mode colorization
 
 (defvar-local context-coloring-js2-scope-level-hash-table nil
-  "Associates `js2-scope' structures and with their scope
+  "Associate `js2-scope' structures and with their scope
   levels.")
 
 (defcustom context-coloring-js-block-scopes nil
   "If non-nil, also color block scopes in the scope hierarchy in JavaScript.
 
-The block-scoped `let' and `const' are introduced in ES6.  If you
-are writing ES6 code, enable this; otherwise, don't.
+The block-scoped `let' and `const' are introduced in ES6.  Enable
+this for ES6 code; disable it elsewhere.
 
 Supported modes: `js2-mode'"
   :group 'context-coloring)
 
 (defsubst context-coloring-js2-scope-level (scope)
-  "Gets the level of SCOPE."
+  "Return the level of SCOPE."
   (cond ((gethash scope context-coloring-js2-scope-level-hash-table))
 (t
  (let ((level 0)
@@ -180,7 +180,7 @@ Supported modes: `js2-mode'"
(puthash scope level 
context-coloring-js2-scope-level-hash-table)
 
 (defsubst context-coloring-js2-local-name-node-p (node)
-  "Determines if NODE is a js2-name-node representing a local
+  "Determine if NODE is a `js2-name-node' representing a local
 variable."
   (and (js2-name-node-p node)
(let ((parent (js2-node-parent node)))
@@ -192,7 +192,7 @@ variable."
(eq node (js2-prop-get-node-right parent
 
 (defsubst context-coloring-js2-colorize-node (node level)
-  "Colors NODE with the color for LEVEL."
+  "Color NODE with the color for LEVEL."
   (let ((start (js2-node-abs-pos node)))
 (context-coloring-colorize-region
  start
@@ -200,8 +200,8 @@ variable."
  level)))
 
 (defun context-coloring-js2-colorize ()
-  "Colorizes the current buffer using the abstract syntax tree
-generated by js2-mode."
+  "Color the current buffer using the abstract syntax tree
+generated by `js2-mode'."
   ;; Reset the hash table; the old one could be obsolete.
   (setq context-coloring-js2-scope-level-hash-table (make-hash-table :test 
'eq))
   (with-silent-modifications
@@ -235,8 +235,8 @@ generated by js2-mode."
 ;;; Shell command scopification / colorization
 
 (defun context-coloring-apply-tokens (tokens)
-  "Processes a vector of TOKENS to apply context-based coloring
-to the current buffer.  Tokens are 3 integers: start, end, level.
+  "Process a vector of TOKENS to apply context-based coloring to
+the current buffer.  Tokens are 3 integers: start, end, level.
 The vector is flat, with a new token occurring after every 3rd
 element."
   (with-silent-modifications
@@ -251,27 +251,25 @@ element."
 (context-coloring-maybe-colorize-comments-and-strings)))
 
 (defun context-coloring-parse-array (input)
-  "Specialized JSON parser for a flat array of numbers."
+  "Parse a flat JSON array of numbers."
   (vconcat
(mapcar 'string-to-number (split-string (substring input 1 -1) ","
 
 (defvar-local context-coloring-scopifier-process nil
-  "Reference to the single scopifier process that can be
-  running.")
+  "The single scopifier process that can be running.")
 
 (defun context-coloring-kill-scopifier ()
-  "Kills the currently-running scopifier process for this
-buffer."
+  "Kill the currently-running scopifier process."
   (when (not (null context-coloring-scopifier-process))
 (delete-process context-coloring-scopifier-process)
 (setq context-coloring-scopifier-process nil)))
 
 (defun context-coloring-scopify-shell-command (command &optional callback)
-  "Invokes a scopifier with the current buffer's contents,
-reading the scopifier's response asynchronously and applying a
-parsed list of tokens to `context-coloring-ap

[elpa] master f52a5e5 26/26: Merge commit 'f4e1cbc5386fbf197ff8bcb6a9275f17c9cbe8e4' from context-coloring

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit f52a5e58fccffa3071fa3d0183d6b281f8a148c2
Merge: 3b749e8 f4e1cbc
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge commit 'f4e1cbc5386fbf197ff8bcb6a9275f17c9cbe8e4' from 
context-coloring
---
 packages/context-coloring/Makefile |   11 +-
 .../benchmark/context-coloring-benchmark.el|   24 +-
 packages/context-coloring/context-coloring.el  |  378 ++--
 .../context-coloring/test/context-coloring-test.el |  147 
 4 files changed, 287 insertions(+), 273 deletions(-)

diff --git a/packages/context-coloring/Makefile 
b/packages/context-coloring/Makefile
index 2d37cd6..c265382 100644
--- a/packages/context-coloring/Makefile
+++ b/packages/context-coloring/Makefile
@@ -1,7 +1,7 @@
 EMACS = emacs
 DEPENDENCIES = libraries/ert-async.el libraries/js2-mode.el
 
-all: clean compile test
+all: uncompile compile test
 
 bench: ${DEPENDENCIES}
${EMACS} -Q \
@@ -17,8 +17,11 @@ compile: ${DEPENDENCIES}
-L libraries \
-f batch-byte-compile *.el libraries/*.el
 
-clean:
-   rm -f *.elc libraries/*.elc ${DEPENDENCIES}
+uncompile:
+   rm -f *.elc libraries/*.elc
+
+clean: uncompile
+   rm -f ${DEPENDENCIES}
 
 ${DEPENDENCIES}:
${EMACS} -Q -batch \
@@ -34,4 +37,4 @@ test: ${DEPENDENCIES}
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 
-.PHONY: all bench compile clean test
+.PHONY: all bench compile uncompile clean test
diff --git a/packages/context-coloring/benchmark/context-coloring-benchmark.el 
b/packages/context-coloring/benchmark/context-coloring-benchmark.el
index 004b66f..3da8d79 100644
--- a/packages/context-coloring/benchmark/context-coloring-benchmark.el
+++ b/packages/context-coloring/benchmark/context-coloring-benchmark.el
@@ -17,8 +17,19 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
+;;; Commentary:
+
+;; Benchmarks for context-coloring.
+
+;; `ert' instruments and benchmarks the package's functions, and the results 
are
+;; logged to `benchmark/logs'.
+
+;; To run, execute `make bench' from the project root.
+
 ;;; Code:
 
+(require 'js2-mode)
+
 (defconst context-coloring-benchmark-path
   (file-name-directory (or load-file-name buffer-file-name))
   "This file's directory.")
@@ -28,7 +39,7 @@
   (expand-file-name path context-coloring-benchmark-path))
 
 (defun context-coloring-benchmark-log-results (result-file fixture)
-  "Log benchmarking results for FIXTURE to RESULT-FILE."
+  "Log benchmarking results to RESULT-FILE for fixture FIXTURE."
   (elp-results)
   (let ((results-buffer (current-buffer)))
 (with-temp-buffer
@@ -49,7 +60,8 @@ asynchrony."
   "Run the next test in LIST by calling CONTINUE.  When LIST is
 exhausted, call STOP instead."
   (if (null list)
-  (context-coloring-benchmark-next-tick stop)
+  (progn
+(context-coloring-benchmark-next-tick stop))
 (context-coloring-benchmark-next-tick
  (lambda ()
(funcall
@@ -59,8 +71,9 @@ exhausted, call STOP instead."
   (context-coloring-benchmark-next (cdr list) continue stop)))
 
 (defun context-coloring-benchmark-async (title setup teardown fixtures 
callback)
-  "Measure the performance of all FIXTURES, calling CALLBACK when
-all are done."
+  "Execute a benchmark titled TITLE with SETUP and TEARDOWN
+callbacks.  Measure the performance of all FIXTURES, calling
+CALLBACK when all are done."
   (funcall setup)
   (let ((result-file (context-coloring-benchmark-resolve-path
   (format "./logs/results-%s-%s.log"
@@ -92,7 +105,7 @@ all are done."
  (find-file fixture)))
  (lambda ()
(funcall teardown)
-   (if callback (funcall callback))
+   (when callback (funcall callback))
 
 (defconst context-coloring-benchmark-js-fixtures
   '("./fixtures/jquery-2.1.1.js"
@@ -121,7 +134,6 @@ all are done."
 
 (defun context-coloring-benchmark-js2-mode-setup ()
   "Preparation logic for `js2-mode'."
-  (require 'js2-mode)
   (setq js2-mode-show-parse-errors nil)
   (setq js2-mode-show-strict-warnings nil)
   (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
diff --git a/packages/context-coloring/context-coloring.el 
b/packages/context-coloring/context-coloring.el
index 6b6ffe9..849d392 100644
--- a/packages/context-coloring/context-coloring.el
+++ b/packages/context-coloring/context-coloring.el
@@ -5,7 +5,7 @@
 ;; Author: Jackson Ray Hamilton 
 ;; URL: https://github.com/jacksonrayhamilton/context-coloring
 ;; Keywords: context coloring syntax highlighting
-;; Version: 5.0.0
+;; Version: 6.0.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.
@@ -34,8 +34,8 @@
 
 ;; Lexical scope information at-a-glance can assist a programmer in
 ;; understanding the overall structure of a program.  It can help to curb nasty
-;; bugs like name shadowing.  A ra

[elpa] master 351142e 07/26: More disciplined use of `if'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 351142efaf9b520d610780a34de810f14a74d1b1
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

More disciplined use of `if'.
---
 benchmark/context-coloring-benchmark.el |5 +++--
 context-coloring.el |   18 ++
 test/context-coloring-test.el   |4 ++--
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/benchmark/context-coloring-benchmark.el 
b/benchmark/context-coloring-benchmark.el
index 004b66f..887cdc8 100644
--- a/benchmark/context-coloring-benchmark.el
+++ b/benchmark/context-coloring-benchmark.el
@@ -49,7 +49,8 @@ asynchrony."
   "Run the next test in LIST by calling CONTINUE.  When LIST is
 exhausted, call STOP instead."
   (if (null list)
-  (context-coloring-benchmark-next-tick stop)
+  (progn
+(context-coloring-benchmark-next-tick stop))
 (context-coloring-benchmark-next-tick
  (lambda ()
(funcall
@@ -92,7 +93,7 @@ all are done."
  (find-file fixture)))
  (lambda ()
(funcall teardown)
-   (if callback (funcall callback))
+   (when callback (funcall callback))
 
 (defconst context-coloring-benchmark-js-fixtures
   '("./fixtures/jquery-2.1.1.js"
diff --git a/context-coloring.el b/context-coloring.el
index fbc49b8..076575c 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -339,7 +339,7 @@ Invokes CALLBACK when complete."
(with-current-buffer buffer
  (context-coloring-apply-tokens tokens))
(setq context-coloring-scopifier-process nil)
-   (if callback (funcall callback)))
+   (when callback (funcall callback)))
 
   ;; Give the process its input so it can begin.
   (process-send-region
@@ -428,8 +428,8 @@ of the current buffer, then executes it.
 Invokes CALLBACK when complete.  It is invoked synchronously for
 elisp tracks, and asynchronously for shell command tracks."
   (let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
-(if (null dispatch)
-(message "%s" "Context coloring is not available for this major mode"))
+(when (null dispatch)
+  (message "%s" "Context coloring is not available for this major mode"))
 (let (colorizer
   scopifier
   command
@@ -437,15 +437,16 @@ elisp tracks, and asynchronously for shell command 
tracks."
   (cond
((setq colorizer (plist-get dispatch :colorizer))
 (funcall colorizer)
-(if callback (funcall callback)))
+(when callback (funcall callback)))
((setq scopifier (plist-get dispatch :scopifier))
 (context-coloring-apply-tokens (funcall scopifier))
-(if callback (funcall callback)))
+(when callback (funcall callback)))
((setq command (plist-get dispatch :command))
 (setq executable (plist-get dispatch :executable))
 (if (and executable
  (null (executable-find executable)))
-(message "Executable \"%s\" not found" executable)
+(progn
+  (message "Executable \"%s\" not found" executable))
   (context-coloring-scopify-shell-command command callback)))
 
 
@@ -461,7 +462,7 @@ Invokes CALLBACK when complete; see 
`context-coloring-dispatch'."
  (lambda ()
(when context-coloring-benchmark-colorization
  (message "Colorization took %.3f seconds" (- (float-time) 
start-time)))
-   (if callback (funcall callback))
+   (when callback (funcall callback))
 
 (defun context-coloring-change-function (_start _end _length)
   "Registers a change so that a buffer can be colorized soon."
@@ -685,7 +686,8 @@ faces for custom themes that might not exist yet."
   (when (custom-theme-p theme) ; Guard against non-existent themes.
 (let ((enabled-theme (car custom-enabled-themes)))
   (if (context-coloring-theme-p enabled-theme)
-  (context-coloring-enable-theme enabled-theme)
+  (progn
+(context-coloring-enable-theme enabled-theme))
 ;; 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
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 87568fe..7c23d89 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -80,7 +80,7 @@ to run arbitrary code before the mode is invoked."
   (context-coloring-test-with-temp-buffer-async
(lambda (done-with-temp-buffer)
  (context-coloring-test-setup)
- (if setup (funcall setup))
+ (when setup (funcall setup))
  (insert (context-coloring-test-read-file fixture))
  (funcall
   callback
@@ -247,7 +247,7 @@ EXPECTED-FACE."
 
 (defun context-coloring-test-kill-buffer (buffer)
   "Kill BUFFER if it exists."
-  (if (get-buffer buffer) (kill-buffer buffer)))
+  (when (get-buffer buffer) (kill-buffer buffer)))
 
 (defun c

[elpa] master bd11b35 03/26: Avoid using the `font-lock-string-face' color for zenburn.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit bd11b35a55bd9302c1a45c644bf061f51484
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Avoid using the `font-lock-string-face' color for zenburn.
---
 context-coloring.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 89bbfc3..e53cf86 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -699,7 +699,7 @@ faces for custom themes that might not exist yet."
"#401440"
"#0f2050"
"#205070"
-   "#336c6c"
+   "#437c7c"
"#23733c"
"#6b400c"
"#603a60"
@@ -806,7 +806,7 @@ faces for custom themes that might not exist yet."
"#BFEBBF"
"#F0DFAF"
"#DFAF8F"
-   "#CC9393"
+   "#BC8383"
"#DC8CC3"
"#94BFF3"
"#9FC59F"



[elpa] master 75e624c 01/26: Todo.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 75e624cb0c6f8771b8cf1135740e06363069509d
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Todo.
---
 context-coloring.el |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 6b6ffe9..ce2e7aa 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -674,6 +674,9 @@ 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)
 
 (context-coloring-define-theme



[elpa] master ca15a60 09/26: Whitespace.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit ca15a60f5253921c9e051c3341c831757f063eed
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Whitespace.
---
 context-coloring.el |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 6658411..be11d4c 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -140,7 +140,6 @@ and DARK backgrounds."
   (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)



[elpa] master e68d00b 11/26: Whitespace.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit e68d00b0b0cb0763f60b1f180ae5d4a102613102
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Whitespace.
---
 context-coloring.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index a20b338..aa9e4ca 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -34,8 +34,8 @@
 
 ;; Lexical scope information at-a-glance can assist a programmer in
 ;; understanding the overall structure of a program.  It can help to curb nasty
-;; bugs like name shadowing.  A rainbow can indicate excessive complexity. 
State
-;; change within a closure is easily monitored.
+;; bugs like name shadowing.  A rainbow can indicate excessive complexity.
+;; State change within a closure is easily monitored.
 
 ;; By default, Context Coloring still highlights comments and strings
 ;; syntactically.  It is still easy to differentiate code from non-code, and



[elpa] master a49b024 15/26: Whitespace.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit a49b024f81ad2181d40c4125bfb449d7536eeff2
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Whitespace.
---
 context-coloring.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index c5a77fc..9d33b59 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -498,7 +498,7 @@ originally set for THEME, nil otherwise."
 found)
 
 (defun context-coloring-cache-originally-set (theme originally-set)
-  "Remember if THEME had colors originally set for it; if
+  "Remember if THEME had colors originally set for it.  If
 ORIGINALLY-SET is non-nil, it did, otherwise it didn't."
   ;; Caching whether a theme was originally set is kind of dirty, but we have 
to
   ;; do it to remember the past state of the theme.  There are probably some



[elpa] master updated (3b749e8 -> f52a5e5)

2015-02-14 Thread Jackson Ray Hamilton
jackson pushed a change to branch master.

  from  3b749e8   * sml-mode/sml-mode.el: Bump version to make a new release
   new  75e624c   Todo.
   new  880ab8a   Use `maximum-face' instead of `face-count'.
   new  bd11b35   Avoid using the `font-lock-string-face' color for zenburn.
   new  ebbc2f1   Fix documentation for `context-coloring-maximum-face'.
   new  62c38d8   Fix comment.
   new  e451d29   Restore original `context-coloring-maximum-face' value.
   new  351142e   More disciplined use of `if'.
   new  a1b7f3e   Define extra faces in 
`context-coloring-set-colors-default'.
   new  ca15a60   Whitespace.
   new  e5d512f   "Misfeature."
   new  e68d00b   Whitespace.
   new  c125d9f   Reorganize defvars and defcustoms.
   new  0681e94   Remove `set-colors' and `set-colors-default'.
   new  3805110   Reorganize faces. Remove eval macroexpand.
   new  a49b024   Whitespace.
   new  25a8d13   Documentation.
   new  4c3d1da   Rename `defface-default' to `defface-neutral'.
   new  8367e19   Rename `level-face' functions.
   new  bae456d   Use imperative for documentation.
   new  a7db850   Cleanup documentation.
   new  8e5674f   Cleanup documentation.
   new  3d91840   Remove `context-coloring-benchmark-colorization'.
   new  45c0d1a   Add `:setup' and `:teardown' properties to dispatches.
   new  e2d3320   Add `uncompile' Makefile task.
   new  f4e1cbc   Version 6.0.0.
   new  f52a5e5   Merge commit 'f4e1cbc5386fbf197ff8bcb6a9275f17c9cbe8e4' 
from context-coloring


Summary of changes:
 packages/context-coloring/Makefile |   11 +-
 .../benchmark/context-coloring-benchmark.el|   24 +-
 packages/context-coloring/context-coloring.el  |  378 ++--
 .../context-coloring/test/context-coloring-test.el |  147 
 4 files changed, 287 insertions(+), 273 deletions(-)



[elpa] master 3805110 14/26: Reorganize faces. Remove eval macroexpand.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 3805110d29ab6c37ed8de6b8d2906b5577a737d8
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Reorganize faces. Remove eval macroexpand.
---
 context-coloring.el |   32 
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 341efe8..c5a77fc 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -69,17 +69,13 @@
 and DARK backgrounds."
   (let ((face (intern (format "context-coloring-level-%s-face" level)))
 (doc (format "Context coloring face, level %s." level)))
-(eval
- (macroexpand
-  `(defface ,face
- 'type tty)) (:foreground ,tty))
-   (((background light)) (:foreground ,light))
-   (((background dark)) (:foreground ,dark)))
- ,doc
- :group 'context-coloring)
-
-(defvar context-coloring-maximum-face nil
-  "The highest face available for coloring.")
+(custom-declare-face
+ face
+ `type tty)) (:foreground ,tty))
+   (((background light)) (:foreground ,light))
+   (((background dark)) (:foreground ,dark)))
+ doc
+ :group 'context-coloring)))
 
 (defun context-coloring-defface-default (level)
   "Define a face for LEVEL with the default neutral colors."
@@ -94,12 +90,20 @@ and DARK backgrounds."
 (context-coloring-defface 6 "red" "#008000" "#ffe390")
 (context-coloring-defface-default 7)
 
+(defvar context-coloring-maximum-face nil
+  "The highest face available for coloring.")
+
+(defvar context-coloring-original-maximum-face nil
+  "Value for `context-coloring-maximum-face' to fall back to
+  when all themes have been disabled.")
+
 (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.
+;; for nested levels, and 1 (25th) for infinity.
 (dotimes (number 18)
   (context-coloring-defface-default (+ number context-coloring-maximum-face 
1)))
 
@@ -633,10 +637,6 @@ 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."



[elpa] master a7db850 20/26: Cleanup documentation.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit a7db850e81c58e70bf52c28a433a21471244a3db
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup documentation.
---
 test/context-coloring-test.el |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 0e6e03f..da32a3e 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -132,7 +132,7 @@ format."
(funcall done))
 
 (defmacro context-coloring-test-deftest-js2-mode (name)
-"Define a test for `js2-mode' in the typical format."
+  "Define a test for `js2-mode' in the typical format."
   (let ((test-name (intern (format "context-coloring-test-js2-mode-%s" name)))
 (fixture (format "./fixtures/%s.js" name))
 (function-name (intern-soft
@@ -146,9 +146,9 @@ format."
 ;;; Assertion functions
 
 (defmacro context-coloring-test-assert-region (&rest body)
-  "Skeleton for asserting something about the face of points in a
-region.  Provides the free variables `i', `length', `point',
-`face' and `actual-level'."
+  "Assert something about the face of points in a region.
+Provides the free variables `i', `length', `point', `face' and
+`actual-level'."
   `(let ((i 0)
  (length (- end start)))
  (while (< i length)
@@ -199,7 +199,7 @@ EXPECTED-FACE."
start end 'font-lock-comment-delimiter-face))
 
 (defun context-coloring-test-assert-region-comment (start end)
-"Assert that all points in the range [START, END) have
+  "Assert that all points in the range [START, END) have
 `font-lock-comment-face'."
   (context-coloring-test-assert-region-face
start end 'font-lock-comment-face))
@@ -299,7 +299,7 @@ FOREGROUND."
 (defun context-coloring-test-assert-theme-originally-set-p
 (settings &optional negate)
   "Assert that `context-coloring-theme-originally-set-p' returns
-t for a theme with SETTINGS (or the inverse if NEGATE is
+`t' for a theme with SETTINGS (or the inverse if NEGATE is
 non-nil)."
   (let ((theme (context-coloring-test-get-next-theme)))
 (put theme 'theme-settings settings)
@@ -314,7 +314,7 @@ non-nil)."
 
 (defun context-coloring-test-assert-not-theme-originally-set-p (&rest 
arguments)
   "Assert that `context-coloring-theme-originally-set-p' does not
-return t for a theme with SETTINGS."
+return `t' for a theme with SETTINGS."
   (apply 'context-coloring-test-assert-theme-originally-set-p
  (append arguments '(t
 



[elpa] master e5d512f 10/26: "Misfeature."

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit e5d512f99b7a25cad566f1ba614c61aed13a1f30
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

"Misfeature."
---
 context-coloring.el |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index be11d4c..a20b338 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -870,8 +870,4 @@ faces for custom themes that might not exist yet."
 
 (provide 'context-coloring)
 
-;; Local Variables:
-;; eval: (when (fboundp 'rainbow-mode) (rainbow-mode 1))
-;; End:
-
 ;;; context-coloring.el ends here



[elpa] master 8e5674f 21/26: Cleanup documentation.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 8e5674fbe0efdf8f790551b6fef73c1f8ddf79b5
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup documentation.
---
 benchmark/context-coloring-benchmark.el |   19 ++--
 context-coloring.el |   18 +++---
 test/context-coloring-test.el   |   83 +--
 3 files changed, 80 insertions(+), 40 deletions(-)

diff --git a/benchmark/context-coloring-benchmark.el 
b/benchmark/context-coloring-benchmark.el
index 887cdc8..3da8d79 100644
--- a/benchmark/context-coloring-benchmark.el
+++ b/benchmark/context-coloring-benchmark.el
@@ -17,8 +17,19 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
+;;; Commentary:
+
+;; Benchmarks for context-coloring.
+
+;; `ert' instruments and benchmarks the package's functions, and the results 
are
+;; logged to `benchmark/logs'.
+
+;; To run, execute `make bench' from the project root.
+
 ;;; Code:
 
+(require 'js2-mode)
+
 (defconst context-coloring-benchmark-path
   (file-name-directory (or load-file-name buffer-file-name))
   "This file's directory.")
@@ -28,7 +39,7 @@
   (expand-file-name path context-coloring-benchmark-path))
 
 (defun context-coloring-benchmark-log-results (result-file fixture)
-  "Log benchmarking results for FIXTURE to RESULT-FILE."
+  "Log benchmarking results to RESULT-FILE for fixture FIXTURE."
   (elp-results)
   (let ((results-buffer (current-buffer)))
 (with-temp-buffer
@@ -60,8 +71,9 @@ exhausted, call STOP instead."
   (context-coloring-benchmark-next (cdr list) continue stop)))
 
 (defun context-coloring-benchmark-async (title setup teardown fixtures 
callback)
-  "Measure the performance of all FIXTURES, calling CALLBACK when
-all are done."
+  "Execute a benchmark titled TITLE with SETUP and TEARDOWN
+callbacks.  Measure the performance of all FIXTURES, calling
+CALLBACK when all are done."
   (funcall setup)
   (let ((result-file (context-coloring-benchmark-resolve-path
   (format "./logs/results-%s-%s.log"
@@ -122,7 +134,6 @@ all are done."
 
 (defun context-coloring-benchmark-js2-mode-setup ()
   "Preparation logic for `js2-mode'."
-  (require 'js2-mode)
   (setq js2-mode-show-parse-errors nil)
   (setq js2-mode-show-strict-warnings nil)
   (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
diff --git a/context-coloring.el b/context-coloring.el
index ae7684d..47cb00b 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -250,10 +250,10 @@ element."
 (setq i (+ i 3
 (context-coloring-maybe-colorize-comments-and-strings)))
 
-(defun context-coloring-parse-array (input)
-  "Parse a flat JSON array of numbers."
+(defun context-coloring-parse-array (array)
+  "Parse ARRAY as a flat JSON array of numbers."
   (vconcat
-   (mapcar 'string-to-number (split-string (substring input 1 -1) ","
+   (mapcar 'string-to-number (split-string (substring array 1 -1) ","
 
 (defvar-local context-coloring-scopifier-process nil
   "The single scopifier process that can be running.")
@@ -265,7 +265,7 @@ element."
 (setq context-coloring-scopifier-process nil)))
 
 (defun context-coloring-scopify-shell-command (command &optional callback)
-  "Invoke a scopifier with the current buffer's contents,
+  "Invoke a scopifier via COMMAND with the current buffer's contents,
 read the scopifier's response asynchronously and apply a parsed
 list of tokens to `context-coloring-apply-tokens'.
 
@@ -455,7 +455,7 @@ used.")
   "Map theme names to theme properties.")
 
 (defun context-coloring-theme-p (theme)
-  "Return `t' if THEME is defined, `nil' otherwise."
+  "Return t if THEME is defined, nil otherwise."
   (and (gethash theme context-coloring-theme-hash-table)))
 
 (defconst context-coloring-level-face-regexp
@@ -468,8 +468,8 @@ used.")
   `context-coloring-level-N-face' faces.")
 
 (defun context-coloring-theme-originally-set-p (theme)
-  "Return `t' if there is a `context-coloring-level-N-face'
-originally set for THEME, `nil' otherwise."
+  "Return t if there is a `context-coloring-level-N-face'
+originally set for THEME, nil otherwise."
   (let (originally-set)
 (cond
  ;; `setq' might return a non-nil value for the sake of this `cond'.
@@ -504,8 +504,8 @@ ORIGINALLY-SET is non-nil, it did, otherwise it didn't."
context-coloring-originally-set-theme-hash-table))
 
 (defun context-coloring-warn-theme-originally-set (theme)
-  "Warn the user that the colors for a theme are already
-originally set."
+  "Warn the user that the colors for THEME are already originally
+set."
   (warn "Context coloring colors for theme `%s' are already defined" theme))
 
 (defun context-coloring-theme-highest-level (theme)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index da32a3e..88a7158 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -17,6 +17,15 @@
 ;

[elpa] master 45c0d1a 23/26: Add `:setup' and `:teardown' properties to dispatches.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 45c0d1af2342ad8f4adc580a48ff0d7d35f9c7a3
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add `:setup' and `:teardown' properties to dispatches.
---
 context-coloring.el |   60 ++-
 1 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index b9f5cc4..574f0bc 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -354,7 +354,13 @@ buffer a returns a flat vector of start, end and level 
data.
 
 `:command' - Shell command to execute with the current buffer
 sent via stdin, and with a flat JSON array of start, end and
-level data returned via stdout."
+level data returned via stdout.
+
+`:setup' - Arbitrary code to set up this dispatch when
+`context-coloring-mode' is enabled.
+
+`:teardown' - Arbitrary code to tear down this dispatch when
+`context-coloring-mode' is disabled."
   (let ((modes (plist-get properties :modes))
 (colorizer (plist-get properties :colorizer))
 (scopifier (plist-get properties :scopifier))
@@ -379,7 +385,13 @@ level data returned via stdout."
 (context-coloring-define-dispatch
  'javascript-js2
  :modes '(js2-mode)
- :colorizer 'context-coloring-js2-colorize)
+ :colorizer 'context-coloring-js2-colorize
+ :setup
+ (lambda ()
+   (add-hook 'js2-post-parse-callbacks 'context-coloring-colorize nil t))
+ :teardown
+ (lambda ()
+   (remove-hook 'js2-post-parse-callbacks 'context-coloring-colorize t)))
 
 (defun context-coloring-dispatch (&optional callback)
   "Determine the optimal track for scopification / coloring of
@@ -804,10 +816,15 @@ Supported modes: `js-mode', `js3-mode'"
 (context-coloring-kill-scopifier)
 (when context-coloring-colorize-idle-timer
   (cancel-timer context-coloring-colorize-idle-timer))
-(remove-hook
- 'js2-post-parse-callbacks 'context-coloring-colorize t)
-(remove-hook
- 'after-change-functions 'context-coloring-change-function t)
+(let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
+  (when dispatch
+(let ((command (plist-get dispatch :command))
+  (teardown (plist-get dispatch :teardown)))
+  (when command
+(remove-hook
+ 'after-change-functions 'context-coloring-change-function t))
+  (when teardown
+(funcall teardown)
 (font-lock-mode)
 (jit-lock-mode t))
 
@@ -818,21 +835,24 @@ Supported modes: `js-mode', `js3-mode'"
 (font-lock-mode 0)
 (jit-lock-mode nil)
 
-;; Colorize once initially.
-(context-coloring-colorize)
+(let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
+  (when dispatch
+(let ((command (plist-get dispatch :command))
+  (setup (plist-get dispatch :setup)))
+  (when command
+;; Shell commands recolor on change, idly.
+(add-hook
+ 'after-change-functions 'context-coloring-change-function nil t)
+(setq context-coloring-colorize-idle-timer
+  (run-with-idle-timer
+   context-coloring-delay
+   t
+   'context-coloring-maybe-colorize)))
+  (when setup
+(funcall setup)
 
-(cond
- ((equal major-mode 'js2-mode)
-  ;; Only recolor on reparse.
-  (add-hook 'js2-post-parse-callbacks 'context-coloring-colorize nil t))
- (t
-  ;; Only recolor on change, idly.
-  (add-hook 'after-change-functions 'context-coloring-change-function nil 
t)
-  (setq context-coloring-colorize-idle-timer
-(run-with-idle-timer
- context-coloring-delay
- t
- 'context-coloring-maybe-colorize))
+;; Colorize once initially.
+(context-coloring-colorize)))
 
 (provide 'context-coloring)
 



[elpa] master c125d9f 12/26: Reorganize defvars and defcustoms.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit c125d9fc9e6eeb8ba5a315dd7a061e6b32f17f4d
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Reorganize defvars and defcustoms.
---
 context-coloring.el |   83 --
 1 files changed, 40 insertions(+), 43 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index aa9e4ca..5d18157 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -56,54 +56,11 @@
 (require 'js2-mode)
 
 
-;;; Customizable options
-
-(defcustom context-coloring-delay 0.25
-  "Delay between a buffer update and colorization.
-
-Increase this if your machine is high-performing.  Decrease it if
-it ain't.
-
-Supported modes: `js-mode', `js3-mode'"
-  :group 'context-coloring)
-
-(defcustom context-coloring-comments-and-strings t
-  "If non-nil, also color comments and strings using `font-lock'."
-  :group 'context-coloring)
-
-(defcustom context-coloring-js-block-scopes nil
-  "If non-nil, also color block scopes in the scope hierarchy in JavaScript.
-
-The block-scoped `let' and `const' are introduced in ES6.  If you
-are writing ES6 code, enable this; otherwise, don't.
-
-Supported modes: `js2-mode'"
-  :group 'context-coloring)
-
-(defcustom context-coloring-benchmark-colorization nil
-  "If non-nil, track how long colorization takes and print
-messages with the colorization duration."
-  :group 'context-coloring)
-
-
 ;;; Local variables
 
 (defvar-local context-coloring-buffer nil
   "Reference to this buffer (for timers).")
 
-(defvar-local context-coloring-scopifier-process nil
-  "Reference to the single scopifier process that can be
-  running.")
-
-(defvar-local context-coloring-colorize-idle-timer nil
-  "Reference to the currently-running idle timer.")
-
-(defvar-local context-coloring-changed nil
-  "Indication that the buffer has changed recently, which would
-imply that it should be colorized again by
-`context-coloring-colorize-idle-timer' if that timer is being
-used.")
-
 
 ;;; Faces
 
@@ -186,6 +143,10 @@ END (exclusive) with the face corresponding to LEVEL."
end
`(face ,(context-coloring-level-face level
 
+(defcustom context-coloring-comments-and-strings t
+  "If non-nil, also color comments and strings using `font-lock'."
+  :group 'context-coloring)
+
 (defsubst context-coloring-maybe-colorize-comments-and-strings ()
   "Colorizes the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
@@ -200,6 +161,15 @@ END (exclusive) with the face corresponding to LEVEL."
   "Associates `js2-scope' structures and with their scope
   levels.")
 
+(defcustom context-coloring-js-block-scopes nil
+  "If non-nil, also color block scopes in the scope hierarchy in JavaScript.
+
+The block-scoped `let' and `const' are introduced in ES6.  If you
+are writing ES6 code, enable this; otherwise, don't.
+
+Supported modes: `js2-mode'"
+  :group 'context-coloring)
+
 (defsubst context-coloring-js2-scope-level (scope)
   "Gets the level of SCOPE."
   (cond ((gethash scope context-coloring-js2-scope-level-hash-table))
@@ -296,6 +266,10 @@ element."
   (vconcat
(mapcar 'string-to-number (split-string (substring input 1 -1) ","
 
+(defvar-local context-coloring-scopifier-process nil
+  "Reference to the single scopifier process that can be
+  running.")
+
 (defun context-coloring-kill-scopifier ()
   "Kills the currently-running scopifier process for this
 buffer."
@@ -451,6 +425,11 @@ elisp tracks, and asynchronously for shell command tracks."
 
 ;;; Colorization
 
+(defcustom context-coloring-benchmark-colorization nil
+  "If non-nil, track how long colorization takes and print
+messages with the colorization duration."
+  :group 'context-coloring)
+
 (defun context-coloring-colorize (&optional callback)
   "Colors the current buffer by function context.
 
@@ -463,6 +442,12 @@ Invokes CALLBACK when complete; see 
`context-coloring-dispatch'."
  (message "Colorization took %.3f seconds" (- (float-time) 
start-time)))
(when callback (funcall callback))
 
+(defvar-local context-coloring-changed nil
+  "Indication that the buffer has changed recently, which would
+imply that it should be colorized again by
+`context-coloring-colorize-idle-timer' if that timer is being
+used.")
+
 (defun context-coloring-change-function (_start _end _length)
   "Registers a change so that a buffer can be colorized soon."
   ;; Tokenization is obsolete if there was a change.
@@ -829,6 +814,18 @@ faces for custom themes that might not exist yet."
 
 ;;; Minor mode
 
+(defvar-local context-coloring-colorize-idle-timer nil
+  "Reference to the currently-running idle timer.")
+
+(defcustom context-coloring-delay 0.25
+  "Delay between a buffer update and colorization.
+
+Increase this if your machine is high-performing.  Decrease it if
+it ain't.
+
+Supported modes: `js-mode', `js3-mode'"
+  :group 'context-coloring)
+
 ;;;###autoload
 (define-minor-mode context-coloring-mode
   "Context-ba

[elpa] master 0681e94 13/26: Remove `set-colors' and `set-colors-default'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 0681e9463b4d826977a97b7f1ece9fac2aa9fb0f
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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   "#00" "#ff")
-  (context-coloring-defface 1 "yellow"  "#007f80" "#80")
-  (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   "#00" "#ff")
+(context-coloring-defface 1 "yellow"  "#007f80" "#80")
+(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
-   "#00"
-   "#11"
-   "#22"
-   "#33"
-   "#44"
-   "#55"
-  

[elpa] master e2d3320 24/26: Add `uncompile' Makefile task.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit e2d33201687a37a834ae6dee8031f5cdf0123603
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add `uncompile' Makefile task.
---
 Makefile |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 2d37cd6..c265382 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 EMACS = emacs
 DEPENDENCIES = libraries/ert-async.el libraries/js2-mode.el
 
-all: clean compile test
+all: uncompile compile test
 
 bench: ${DEPENDENCIES}
${EMACS} -Q \
@@ -17,8 +17,11 @@ compile: ${DEPENDENCIES}
-L libraries \
-f batch-byte-compile *.el libraries/*.el
 
-clean:
-   rm -f *.elc libraries/*.elc ${DEPENDENCIES}
+uncompile:
+   rm -f *.elc libraries/*.elc
+
+clean: uncompile
+   rm -f ${DEPENDENCIES}
 
 ${DEPENDENCIES}:
${EMACS} -Q -batch \
@@ -34,4 +37,4 @@ test: ${DEPENDENCIES}
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 
-.PHONY: all bench compile clean test
+.PHONY: all bench compile uncompile clean test



[elpa] master 8367e19 18/26: Rename `level-face' functions.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 8367e1907fb1a01a177869541bea36daf0058e57
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Rename `level-face' functions.
---
 context-coloring.el   |   20 ++--
 test/context-coloring-test.el |2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 8b056a5..6c71180 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -110,16 +110,16 @@ backgrounds."
 
 ;;; Face functions
 
-(defsubst context-coloring-face-symbol (level)
-  "Returns a symbol for a face with LEVEL."
+(defsubst context-coloring-level-face (level)
+  "Return the symbol for a face with LEVEL."
   ;; `concat' is faster than `format' here.
-  (intern-soft (concat "context-coloring-level-"
-   (number-to-string level)
-   "-face")))
+  (intern-soft
+   (concat "context-coloring-level-" (number-to-string level) "-face")))
 
-(defsubst context-coloring-level-face (level)
-  "Returns the face name for LEVEL."
-  (context-coloring-face-symbol (min level context-coloring-maximum-face)))
+(defsubst context-coloring-bounded-level-face (level)
+  "Return the symbol for a face with LEVEL, bounded by
+`context-coloring-maximum-face'."
+  (context-coloring-level-face (min level context-coloring-maximum-face)))
 
 
 ;;; Colorization utilities
@@ -130,7 +130,7 @@ END (exclusive) with the face corresponding to LEVEL."
   (add-text-properties
start
end
-   `(face ,(context-coloring-level-face level
+   `(face ,(context-coloring-bounded-level-face level
 
 (defcustom context-coloring-comments-and-strings t
   "If non-nil, also color comments and strings using `font-lock'."
@@ -550,7 +550,7 @@ which must already exist and which *should* already be 
enabled."
  (mapcar
   (lambda (color)
 (setq level (+ level 1))
-`(,(context-coloring-face-symbol level) ((t (:foreground ,color)
+`(,(context-coloring-level-face level) ((t (:foreground ,color)
   colors
 
 (defun context-coloring-define-theme (theme &rest properties)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 61e24b1..0e6e03f 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -251,7 +251,7 @@ EXPECTED-FACE."
 (defun context-coloring-test-assert-face (level foreground &optional negate)
   "Assert that a face for LEVEL exists and that its `:foreground'
 is FOREGROUND."
-  (let* ((face (context-coloring-face-symbol level))
+  (let* ((face (context-coloring-level-face level))
  actual-foreground)
 (when (not (or negate
face))



[elpa] master 62c38d8 05/26: Fix comment.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 62c38d8e117cc43431134fafd448b08df1295c53
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix comment.
---
 context-coloring.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 89ffa75..f069e95 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -141,8 +141,8 @@ and DARK backgrounds."
 
 (context-coloring-set-colors-default)
 
-;; Color theme authors can have up to 26 levels: 1 (0th) for globals, 24
-;; (1st-24th) for in-betweens, and 1 (25th) for infinity.
+;; 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)))
 



[elpa] master 3d91840 22/26: Remove `context-coloring-benchmark-colorization'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit 3d91840f31614247b6b3564aaecbf4466d663245
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Remove `context-coloring-benchmark-colorization'.
---
 context-coloring.el |   14 +++---
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 47cb00b..b9f5cc4 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -412,22 +412,14 @@ elisp tracks, and asynchronously for shell command 
tracks."
 
 ;;; Colorization
 
-(defcustom context-coloring-benchmark-colorization nil
-  "If non-nil, track how long colorization takes and print
-messages with the colorization duration."
-  :group 'context-coloring)
-
 (defun context-coloring-colorize (&optional callback)
   "Color the current buffer by function context.
 
 Invoke CALLBACK when complete; see `context-coloring-dispatch'."
   (interactive)
-  (let ((start-time (float-time)))
-(context-coloring-dispatch
- (lambda ()
-   (when context-coloring-benchmark-colorization
- (message "Colorization took %.3f seconds" (- (float-time) 
start-time)))
-   (when callback (funcall callback))
+  (context-coloring-dispatch
+   (lambda ()
+ (when callback (funcall callback)
 
 (defvar-local context-coloring-changed nil
   "Indication that the buffer has changed recently, which implies



[elpa] master ebbc2f1 04/26: Fix documentation for `context-coloring-maximum-face'.

2015-02-14 Thread Jackson Ray Hamilton
branch: master
commit ebbc2f19152c69e83d5e63d5ea083e7f547e32d1
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix documentation for `context-coloring-maximum-face'.
---
 context-coloring.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index e53cf86..89ffa75 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -122,7 +122,7 @@ and DARK backgrounds."
  :group 'context-coloring)
 
 (defvar context-coloring-maximum-face nil
-  "Number of faces available for coloring.")
+  "The highest face available for coloring.")
 
 (defun context-coloring-defface-default (level)
   "Define a face for LEVEL with the default neutral colors."