[elpa] master 6d0ed0e 03/11: Cleanup dependency management.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 6d0ed0ecadb7aeab3ff0bf74aeb411b2aa10d60a
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup dependency management.
---
 Makefile |3 +-
 scripts/dependencies |2 +
 scripts/download-dependencies.el |   41 ++---
 3 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index c265382..3a6a0be 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,8 @@ clean: uncompile
 
 ${DEPENDENCIES}:
${EMACS} -Q -batch \
-   -l scripts/download-dependencies.el
+   -l scripts/download-dependencies.el \
+   -f download-dependencies
 
 test: ${DEPENDENCIES}
${EMACS} -Q -batch \
diff --git a/scripts/dependencies b/scripts/dependencies
new file mode 100644
index 000..c2a9107
--- /dev/null
+++ b/scripts/dependencies
@@ -0,0 +1,2 @@
+https://raw.githubusercontent.com/mooz/js2-mode/master/js2-mode.el
+https://raw.githubusercontent.com/rejeep/ert-async.el/master/ert-async.el
diff --git a/scripts/download-dependencies.el b/scripts/download-dependencies.el
index b4a82fc..2ab24e2 100644
--- a/scripts/download-dependencies.el
+++ b/scripts/download-dependencies.el
@@ -17,8 +17,10 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-;; This script downloads some dependencies for development so they don't need 
to
-;; be version-controlled.
+;; Download dependencies for development.
+
+;; Dependencies don't need to be version-controlled. They are also
+;; bleeding-edge, which is good because that is what most MELPA users are 
using.
 
 ;;; Code:
 
@@ -35,20 +37,25 @@
 `url-retrieve-synchronously'."
   (goto-char 1)
   (kill-paragraph 1) ; The headers are 1 paragraph.  I hope.
-  (kill-line); A line separates the headers from the file's content.
-  )
-
-;; Download any missing dependencies.
-(let ((files 
'("https://raw.githubusercontent.com/mooz/js2-mode/master/js2-mode.el";
-   
"https://raw.githubusercontent.com/rejeep/ert-async.el/master/ert-async.el";)))
-  (make-directory (download-dependencies-resolve-path "../libraries") t)
-  (dolist (file files)
-(let* ((basename (file-name-nondirectory file))
-   (destination (download-dependencies-resolve-path
- (concat "../libraries/" basename
-  (when (null (file-exists-p destination))
-(with-current-buffer (url-retrieve-synchronously file)
-  (download-dependencies-strip-headers)
-  (write-file destination))
+  (kill-line))   ; A line separates the headers from the file's content.
+
+(defun download-dependencies-get-dependencies ()
+  "Read the `dependencies' file as a list of URLs."
+  (with-temp-buffer
+(insert-file-contents (download-dependencies-resolve-path 
"./dependencies"))
+(split-string (buffer-substring-no-properties (point-min) (point-max)
+
+(defun download-dependencies ()
+  "Download dependencies for development."
+  (let ((files (download-dependencies-get-dependencies)))
+(make-directory (download-dependencies-resolve-path "../libraries") t)
+(dolist (file files)
+  (let* ((basename (file-name-nondirectory file))
+ (destination (download-dependencies-resolve-path
+   (concat "../libraries/" basename
+(unless (file-exists-p destination)
+  (with-current-buffer (url-retrieve-synchronously file)
+(download-dependencies-strip-headers)
+(write-file destination)))
 
 ;;; download-dependencies.el ends here



[elpa] master 5ef598f 05/11: Refactor tests for setups and reused fixtures.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 5ef598fcd0c064f2a1bfc63b91950050ae717f8a
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Refactor tests for setups and reused fixtures.
---
 test/context-coloring-test.el |   73 +---
 1 files changed, 31 insertions(+), 42 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index e8d6474..7ddf51d 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -114,7 +114,7 @@ instantiated in SETUP."
 (funcall callback done-with-test
setup))
 
-(defmacro context-coloring-test-js2-mode (fixture &rest body)
+(defmacro context-coloring-test-js2-mode (fixture setup &rest body)
   "Use FIXTURE as the subject matter for test logic in BODY."
   `(context-coloring-test-with-fixture
 ,fixture
@@ -122,16 +122,20 @@ instantiated in SETUP."
 (setq js2-mode-show-parse-errors nil)
 (setq js2-mode-show-strict-warnings nil)
 (js2-mode)
+(when ,setup (funcall ,setup))
 (context-coloring-mode)
 ,@body))
 
-(defmacro context-coloring-test-deftest-js-mode (name)
+(cl-defmacro context-coloring-test-deftest-js-mode (name &key fixture-name)
   "Define an asynchronous test for `js-mode' with the name NAME
 in the typical format."
+  (declare (indent defun))
   (let ((test-name (intern (format "context-coloring-test-js-mode-%s" name)))
-(fixture (format "./fixtures/%s.js" name))
+(fixture (format "./fixtures/%s.js" (or fixture-name name)))
 (function-name (intern-soft
-(format "context-coloring-test-js-%s" name
+(format "context-coloring-test-js-%s" name)))
+(setup-function-name (intern-soft
+  (format "context-coloring-test-js-%s-setup" 
name
 `(ert-deftest-async ,test-name (done)
 (context-coloring-test-js-mode
  ,fixture
@@ -139,18 +143,23 @@ in the typical format."
(unwind-protect
(,function-name)
  (funcall teardown))
-   (funcall done))
+   (funcall done))
+ ',setup-function-name
 
-(defmacro context-coloring-test-deftest-js2-mode (name)
+(cl-defmacro context-coloring-test-deftest-js2-mode (name &key fixture-name)
   "Define a test for `js2-mode' with the name NAME in the typical
 format."
+  (declare (indent defun))
   (let ((test-name (intern (format "context-coloring-test-js2-mode-%s" name)))
-(fixture (format "./fixtures/%s.js" name))
+(fixture (format "./fixtures/%s.js" (or fixture-name name)))
 (function-name (intern-soft
-(format "context-coloring-test-js-%s" name
+(format "context-coloring-test-js-%s" name)))
+(setup-function-name (intern-soft
+  (format "context-coloring-test-js-%s-setup" 
name
 `(ert-deftest ,test-name ()
(context-coloring-test-js2-mode
 ,fixture
+',setup-function-name
 (,function-name)
 
 
@@ -700,23 +709,12 @@ see that function."
   (context-coloring-test-assert-region-string 20 32)
   (context-coloring-test-assert-region-level 32 33 0))
 
-(ert-deftest-async context-coloring-test-js-mode-comments-and-strings (done)
-  (context-coloring-test-js-mode
-   "./fixtures/comments-and-strings.js"
-   (lambda (teardown)
- (unwind-protect
- (context-coloring-test-js-comments-and-strings)
-   (funcall teardown))
- (funcall done))
-   (lambda ()
- (setq context-coloring-comments-and-strings t
-
-(ert-deftest context-coloring-test-js2-mode-comments-and-strings ()
-  (context-coloring-test-js2-mode
-   "./fixtures/comments-and-strings.js"
-   (setq context-coloring-comments-and-strings t)
-   (context-coloring-colorize)
-   (context-coloring-test-js-comments-and-strings)))
+(defun context-coloring-test-js-comments-and-strings-setup ()
+  "Setup comments-and-strings."
+  (setq context-coloring-comments-and-strings t))
+
+(context-coloring-test-deftest-js-mode comments-and-strings)
+(context-coloring-test-deftest-js2-mode comments-and-strings)
 
 (defun context-coloring-test-js-syntactic-comments ()
   "Test fixtures/comments-and-strings.js."
@@ -726,23 +724,14 @@ see that function."
   (context-coloring-test-assert-region-comment 12 19)
   (context-coloring-test-assert-region-level 20 33 0))
 
-(ert-deftest-async context-coloring-test-js-mode-syntactic-comments (done)
-  (context-coloring-test-js-mode
-   "./fixtures/comments-and-strings.js"
-   (lambda (teardown)
-

[elpa] master updated (b36c4b4 -> 1d1af16)

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

  from  b36c4b4   packages/javaimp/javaimp.el: use line-beginning-position 
instead of forward-line
   new  5dff74a   Cleanup.
   new  32f67a7   Cleanup.
   new  6d0ed0e   Cleanup dependency management.
   new  ba015ce   Add option to only colorize comments specially.
   new  5ef598f   Refactor tests for setups and reused fixtures.
   new  bde8c44   Add syntactic strings option.
   new  b83709f   Deprecate `comments-and-strings'.
   new  7e208ed   Use the better zenburn red.
   new  4849fd4   Update options documentation.
   new  f062d5a   Version 6.1.0.
   new  1d1af16   Merge commit 'f062d5a55496e22cf89f2ef9778a24a840a5a68e' 
from context-coloring


Summary of changes:
 packages/context-coloring/Makefile |3 +-
 packages/context-coloring/README.md|   20 ++-
 .../benchmark/context-coloring-benchmark.el|2 +
 packages/context-coloring/context-coloring.el  |   56 ++-
 packages/context-coloring/scripts/dependencies |2 +
 .../scripts/download-dependencies.el   |   51 ---
 .../context-coloring/test/context-coloring-test.el |  173 +---
 .../test/fixtures/comments-and-strings.js  |1 +
 8 files changed, 213 insertions(+), 95 deletions(-)
 create mode 100644 packages/context-coloring/scripts/dependencies



[elpa] master ba015ce 04/11: Add option to only colorize comments specially.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit ba015cea148300fb10f19acfcbebf046d52e9258
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add option to only colorize comments specially.
---
 context-coloring.el   |   24 +---
 test/context-coloring-test.el |   27 +++
 2 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 849d392..4755ca0 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -136,12 +136,27 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   "If non-nil, also color comments and strings using `font-lock'."
   :group 'context-coloring)
 
+(defcustom context-coloring-syntactic-comments nil
+  "If non-nil, also color comments using `font-lock'."
+  :group 'context-coloring)
+
+(defun context-coloring-font-lock-syntactic-comment-function (state)
+  "Tell `font-lock' to color a comment but not a string."
+  (if (nth 3 state) nil font-lock-comment-face))
+
 (defsubst context-coloring-maybe-colorize-comments-and-strings ()
   "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
-  (font-lock-fontify-syntactically-region (point-min) (point-max)
+  (when (or context-coloring-comments-and-strings
+context-coloring-syntactic-comments)
+(let ((old-function font-lock-syntactic-face-function))
+  (when context-coloring-syntactic-comments
+(setq font-lock-syntactic-face-function
+  'context-coloring-font-lock-syntactic-comment-function))
+  (save-excursion
+(font-lock-fontify-syntactically-region (point-min) (point-max)))
+  (when context-coloring-syntactic-comments
+(setq font-lock-syntactic-face-function old-function)
 
 
 ;;; js2-mode colorization
@@ -835,6 +850,9 @@ Supported modes: `js-mode', `js3-mode'"
 (font-lock-mode 0)
 (jit-lock-mode nil)
 
+;; Safely change the valye of this function as necessary.
+(make-local-variable 'font-lock-syntactic-face-function)
+
 (let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
   (when dispatch
 (let ((command (plist-get dispatch :command))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 8e26991..e8d6474 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -52,6 +52,7 @@
 (defun context-coloring-test-cleanup ()
   "Cleanup after all tests."
   (setq context-coloring-comments-and-strings t)
+  (setq context-coloring-syntactic-comments nil)
   (setq context-coloring-js-block-scopes nil))
 
 (defmacro context-coloring-test-with-fixture (fixture &rest body)
@@ -717,6 +718,32 @@ see that function."
(context-coloring-colorize)
(context-coloring-test-js-comments-and-strings)))
 
+(defun context-coloring-test-js-syntactic-comments ()
+  "Test fixtures/comments-and-strings.js."
+  (context-coloring-test-assert-region-comment-delimiter 1 4)
+  (context-coloring-test-assert-region-comment 4 8)
+  (context-coloring-test-assert-region-comment-delimiter 9 12)
+  (context-coloring-test-assert-region-comment 12 19)
+  (context-coloring-test-assert-region-level 20 33 0))
+
+(ert-deftest-async context-coloring-test-js-mode-syntactic-comments (done)
+  (context-coloring-test-js-mode
+   "./fixtures/comments-and-strings.js"
+   (lambda (teardown)
+ (unwind-protect
+ (context-coloring-test-js-syntactic-comments)
+   (funcall teardown))
+ (funcall done))
+   (lambda ()
+ (setq context-coloring-syntactic-comments t
+
+(ert-deftest context-coloring-test-js2-mode-syntactic-comments ()
+  (context-coloring-test-js2-mode
+   "./fixtures/comments-and-strings.js"
+   (setq context-coloring-syntactic-comments t)
+   (context-coloring-colorize)
+   (context-coloring-test-js-syntactic-comments)))
+
 (provide 'context-coloring-test)
 
 ;;; context-coloring-test.el ends here



[elpa] master b83709f 07/11: Deprecate `comments-and-strings'.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit b83709f4ad9253631eee27d678c724d770a6b316
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Deprecate `comments-and-strings'.
---
 context-coloring.el   |   12 +---
 test/context-coloring-test.el |   17 +++--
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 5382339..b4082fa 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -132,15 +132,21 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
end
`(face ,(context-coloring-bounded-level-face level
 
-(defcustom context-coloring-comments-and-strings t
+(defcustom context-coloring-comments-and-strings nil
   "If non-nil, also color comments and strings using `font-lock'."
   :group 'context-coloring)
 
-(defcustom context-coloring-syntactic-comments nil
+(make-obsolete-variable
+ 'context-coloring-comments-and-strings
+ "use `context-coloring-syntactic-comments' and
+ `context-coloring-syntactic-strings' instead."
+ "6.1.0")
+
+(defcustom context-coloring-syntactic-comments t
   "If non-nil, also color comments using `font-lock'."
   :group 'context-coloring)
 
-(defcustom context-coloring-syntactic-strings nil
+(defcustom context-coloring-syntactic-strings t
   "If non-nil, also color comments using `font-lock'."
   :group 'context-coloring)
 
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 5801dd8..903da68 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -701,7 +701,7 @@ see that function."
 (context-coloring-test-deftest-js-mode key-values)
 (context-coloring-test-deftest-js2-mode key-values)
 
-(defun context-coloring-test-js-comments-and-strings ()
+(defun context-coloring-test-js-syntactic-comments-and-strings ()
   "Test comments and strings."
   (context-coloring-test-assert-region-level 1 8 0)
   (context-coloring-test-assert-region-comment-delimiter 9 12)
@@ -711,8 +711,21 @@ see that function."
   (context-coloring-test-assert-region-string 28 40)
   (context-coloring-test-assert-region-level 40 41 0))
 
+(defun context-coloring-test-js-syntactic-comments-and-strings-setup ()
+  (setq context-coloring-syntactic-comments t)
+  (setq context-coloring-syntactic-strings t))
+
+(context-coloring-test-deftest-js-mode syntactic-comments-and-strings
+  :fixture-name comments-and-strings)
+(context-coloring-test-deftest-js2-mode syntactic-comments-and-strings
+  :fixture-name comments-and-strings)
+
+(defalias 'context-coloring-test-js-comments-and-strings
+  'context-coloring-test-js-syntactic-comments-and-strings
+  "Test comments and strings.  Deprecated.")
+
 (defun context-coloring-test-js-comments-and-strings-setup ()
-  "Setup comments and strings."
+  "Setup comments and strings.  Deprecated."
   (setq context-coloring-comments-and-strings t))
 
 (context-coloring-test-deftest-js-mode comments-and-strings)



[elpa] master bde8c44 06/11: Add syntactic strings option.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit bde8c441dbafedcb222f4dd0d8877fd9a674c51d
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add syntactic strings option.
---
 context-coloring.el   |   28 ++
 test/context-coloring-test.el |   42 +++-
 test/fixtures/comments-and-strings.js |1 +
 3 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 4755ca0..5382339 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -140,22 +140,40 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   "If non-nil, also color comments using `font-lock'."
   :group 'context-coloring)
 
+(defcustom context-coloring-syntactic-strings nil
+  "If non-nil, also color comments using `font-lock'."
+  :group 'context-coloring)
+
 (defun context-coloring-font-lock-syntactic-comment-function (state)
   "Tell `font-lock' to color a comment but not a string."
   (if (nth 3 state) nil font-lock-comment-face))
 
+(defun context-coloring-font-lock-syntactic-string-function (state)
+  "Tell `font-lock' to color a string but not a comment."
+  (if (nth 3 state) font-lock-string-face nil))
+
 (defsubst context-coloring-maybe-colorize-comments-and-strings ()
   "Color the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
   (when (or context-coloring-comments-and-strings
-context-coloring-syntactic-comments)
-(let ((old-function font-lock-syntactic-face-function))
-  (when context-coloring-syntactic-comments
+context-coloring-syntactic-comments
+context-coloring-syntactic-strings)
+(let ((old-function font-lock-syntactic-face-function)
+  saved-function-p)
+  (cond
+   ((and context-coloring-syntactic-comments
+ (not context-coloring-syntactic-strings))
+(setq font-lock-syntactic-face-function
+  'context-coloring-font-lock-syntactic-comment-function)
+(setq saved-function-p t))
+   ((and context-coloring-syntactic-strings
+ (not context-coloring-syntactic-comments))
 (setq font-lock-syntactic-face-function
-  'context-coloring-font-lock-syntactic-comment-function))
+  'context-coloring-font-lock-syntactic-string-function)
+(setq saved-function-p t)))
   (save-excursion
 (font-lock-fontify-syntactically-region (point-min) (point-max)))
-  (when context-coloring-syntactic-comments
+  (when saved-function-p
 (setq font-lock-syntactic-face-function old-function)
 
 
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 7ddf51d..5801dd8 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -53,6 +53,7 @@
   "Cleanup after all tests."
   (setq context-coloring-comments-and-strings t)
   (setq context-coloring-syntactic-comments nil)
+  (setq context-coloring-syntactic-strings nil)
   (setq context-coloring-js-block-scopes nil))
 
 (defmacro context-coloring-test-with-fixture (fixture &rest body)
@@ -701,28 +702,30 @@ see that function."
 (context-coloring-test-deftest-js2-mode key-values)
 
 (defun context-coloring-test-js-comments-and-strings ()
-  "Test fixtures/comments-and-strings.js."
-  (context-coloring-test-assert-region-comment-delimiter 1 4)
-  (context-coloring-test-assert-region-comment 4 8)
+  "Test comments and strings."
+  (context-coloring-test-assert-region-level 1 8 0)
   (context-coloring-test-assert-region-comment-delimiter 9 12)
-  (context-coloring-test-assert-region-comment 12 19)
-  (context-coloring-test-assert-region-string 20 32)
-  (context-coloring-test-assert-region-level 32 33 0))
+  (context-coloring-test-assert-region-comment 12 16)
+  (context-coloring-test-assert-region-comment-delimiter 17 20)
+  (context-coloring-test-assert-region-comment 20 27)
+  (context-coloring-test-assert-region-string 28 40)
+  (context-coloring-test-assert-region-level 40 41 0))
 
 (defun context-coloring-test-js-comments-and-strings-setup ()
-  "Setup comments-and-strings."
+  "Setup comments and strings."
   (setq context-coloring-comments-and-strings t))
 
 (context-coloring-test-deftest-js-mode comments-and-strings)
 (context-coloring-test-deftest-js2-mode comments-and-strings)
 
 (defun context-coloring-test-js-syntactic-comments ()
-  "Test fixtures/comments-and-strings.js."
-  (context-coloring-test-assert-region-comment-delimiter 1 4)
-  (context-coloring-test-assert-region-comment 4 8)
+  "Test syntactic comments."
+  (context-coloring-test-assert-region-level 1 8 0)
   (context-coloring-test-assert-region-comment-delimiter 9 12)
-  (context-coloring-test-assert-region-comment 12 19)
-  (context-colorin

[elpa] master 5dff74a 01/11: Cleanup.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 5dff74a6a94ed98e4049de2090d82796a3f49873
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup.
---
 benchmark/context-coloring-benchmark.el |2 +
 scripts/download-dependencies.el|   18 +
 test/context-coloring-test.el   |   60 +++---
 3 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/benchmark/context-coloring-benchmark.el 
b/benchmark/context-coloring-benchmark.el
index 3da8d79..2de5646 100644
--- a/benchmark/context-coloring-benchmark.el
+++ b/benchmark/context-coloring-benchmark.el
@@ -28,8 +28,10 @@
 
 ;;; Code:
 
+(require 'context-coloring)
 (require 'js2-mode)
 
+
 (defconst context-coloring-benchmark-path
   (file-name-directory (or load-file-name buffer-file-name))
   "This file's directory.")
diff --git a/scripts/download-dependencies.el b/scripts/download-dependencies.el
index 54211cc..b4a82fc 100644
--- a/scripts/download-dependencies.el
+++ b/scripts/download-dependencies.el
@@ -22,31 +22,33 @@
 
 ;;; Code:
 
-(defconst directory (file-name-directory (or load-file-name buffer-file-name))
+(defconst download-dependencies-directory
+  (file-name-directory (or load-file-name buffer-file-name))
   "This file's directory.")
 
-(defun resolve-path (path)
+(defun download-dependencies-resolve-path (path)
   "Resolve a path relative to this file's directory."
-  (expand-file-name path directory))
+  (expand-file-name path download-dependencies-directory))
 
-(defun strip-headers ()
+(defun download-dependencies-strip-headers ()
   "Remove the http headers included in the output of
 `url-retrieve-synchronously'."
   (goto-char 1)
-  (kill-paragraph 1) ; The headers are 1 paragraph. I hope.
+  (kill-paragraph 1) ; The headers are 1 paragraph.  I hope.
   (kill-line); A line separates the headers from the file's content.
   )
 
 ;; Download any missing dependencies.
 (let ((files 
'("https://raw.githubusercontent.com/mooz/js2-mode/master/js2-mode.el";

"https://raw.githubusercontent.com/rejeep/ert-async.el/master/ert-async.el";)))
-  (make-directory (resolve-path "../libraries") t)
+  (make-directory (download-dependencies-resolve-path "../libraries") t)
   (dolist (file files)
 (let* ((basename (file-name-nondirectory file))
-   (destination (resolve-path (concat "../libraries/" basename
+   (destination (download-dependencies-resolve-path
+ (concat "../libraries/" basename
   (when (null (file-exists-p destination))
 (with-current-buffer (url-retrieve-synchronously file)
-  (strip-headers)
+  (download-dependencies-strip-headers)
   (write-file destination))
 
 ;;; download-dependencies.el ends here
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 88a7158..8e26991 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -28,7 +28,9 @@
 
 ;;; Code:
 
+(require 'context-coloring)
 (require 'ert-async)
+(require 'js2-mode)
 
 
 ;;; Test running utilities
@@ -50,7 +52,6 @@
 (defun context-coloring-test-cleanup ()
   "Cleanup after all tests."
   (setq context-coloring-comments-and-strings t)
-  (setq context-coloring-after-colorize-hook nil)
   (setq context-coloring-js-block-scopes nil))
 
 (defmacro context-coloring-test-with-fixture (fixture &rest body)
@@ -68,16 +69,15 @@ buffer."
   "Create a temporary buffer, and evaluate CALLBACK there.  A
 teardown callback is passed to CALLBACK for it to invoke when it
 is done."
-  (let ((temp-buffer (make-symbol "temp-buffer")))
-(let ((previous-buffer (current-buffer))
-  (temp-buffer (generate-new-buffer " *temp*")))
-  (set-buffer temp-buffer)
-  (funcall
-   callback
-   (lambda ()
- (and (buffer-name temp-buffer)
-  (kill-buffer temp-buffer))
- (set-buffer previous-buffer))
+  (let ((previous-buffer (current-buffer))
+(temp-buffer (generate-new-buffer " *temp*")))
+(set-buffer temp-buffer)
+(funcall
+ callback
+ (lambda ()
+   (and (buffer-name temp-buffer)
+(kill-buffer temp-buffer))
+   (set-buffer previous-buffer)
 
 (defun context-coloring-test-with-fixture-async
 (fixture callback &optional setup)
@@ -163,8 +163,7 @@ Provides the free variables `i', `length', `point', `face' 
and
  (length (- end start)))
  (while (< i length)
(let* ((point (+ i start))
-  (face (get-text-property point 'face))
-  actual-level)
+  (face (get-text-property point 'face)))
  ,@body)
(setq i (+ i 1)
 
@@ -172,23 +171,24 @@ Provides

[elpa] master 7e208ed 08/11: Use the better zenburn red.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 7e208ed1ed94093a379af2b2280da491fd22d6c8
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Use the better zenburn red.
---
 context-coloring.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index b4082fa..1453f48 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -717,7 +717,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
"#401440"
"#0f2050"
"#205070"
-   "#437c7c"
+   "#336c6c"
"#23733c"
"#6b400c"
"#603a60"
@@ -824,7 +824,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
"#BFEBBF"
"#F0DFAF"
"#DFAF8F"
-   "#BC8383"
+   "#CC9393"
"#DC8CC3"
"#94BFF3"
"#9FC59F"



[elpa] master 4849fd4 09/11: Update options documentation.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 4849fd4f4d09af8d3cf2e7cf52408d98c21f8bf7
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Update options documentation.
---
 README.md   |   14 ++
 context-coloring.el |2 +-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index 2341c49..7eeacf7 100644
--- a/README.md
+++ b/README.md
@@ -89,6 +89,20 @@ Add the following to your `~/.emacs` file:
 
 ## Customizing
 
+### Options
+
+- `context-coloring-syntactic-comments` (default: `t`): If non-nil, also color
+  comments using `font-lock`.
+- `context-coloring-syntactic-strings` (default: `t`): If non-nil, also color
+  strings using `font-lock`.
+- `context-coloring-delay` (default: `0.25`; supported modes: `js-mode`,
+  `js3-mode`): Delay between a buffer update and colorization.
+- `context-coloring-js-block-scopes` (default: `nil`; supported modes:
+  `js2-mode`): If non-nil, also color block scopes in the scope hierarchy in
+  JavaScript.
+
+### Color Schemes
+
 Color schemes for custom themes are automatically applied when those themes are
 active. Built-in theme support is available for: `ample`, `anti-zenburn`,
 `grandshell`, `leuven`, `monokai`, `solarized`, `spacegray`, `tango` and
diff --git a/context-coloring.el b/context-coloring.el
index 1453f48..cb64227 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -147,7 +147,7 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   :group 'context-coloring)
 
 (defcustom context-coloring-syntactic-strings t
-  "If non-nil, also color comments using `font-lock'."
+  "If non-nil, also color strings using `font-lock'."
   :group 'context-coloring)
 
 (defun context-coloring-font-lock-syntactic-comment-function (state)



[elpa] master 32f67a7 02/11: Cleanup.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 32f67a7e97c01b89caa63507623fdd57b57eac3f
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup.
---
 README.md |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index ff305c1..2341c49 100644
--- a/README.md
+++ b/README.md
@@ -124,13 +124,13 @@ more info on dispatch strategies.)
 A "scopifier" is a CLI program that reads a buffer's contents from stdin and
 writes a JSON array of numbers to stdout. Every three numbers in the array
 represent a range of color. For instance, if I fed the following string of
-JavaScript code to a scopifier,
+JavaScript code to a scopifier:
 
 ```js
 var a = function () {};
 ```
 
-then the scopifier would produce the following array:
+Then the scopifier would produce the following array:
 
 ```js
 [1,24,0,9,23,1]
@@ -175,7 +175,7 @@ required.
 
 [linter]: http://jshint.com/about/
 [flycheck]: http://www.flycheck.org/
-[point]: http://www.gnu.org/software/emacs/manual/html_node/elisp/Point.html
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier
+[point]: http://www.gnu.org/software/emacs/manual/html_node/elisp/Point.html



[elpa] master 1d1af16 11/11: Merge commit 'f062d5a55496e22cf89f2ef9778a24a840a5a68e' from context-coloring

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit 1d1af16fbd945715c320d093a437767037efb2e3
Merge: b36c4b4 f062d5a
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge commit 'f062d5a55496e22cf89f2ef9778a24a840a5a68e' from 
context-coloring
---
 packages/context-coloring/Makefile |3 +-
 packages/context-coloring/README.md|   20 ++-
 .../benchmark/context-coloring-benchmark.el|2 +
 packages/context-coloring/context-coloring.el  |   56 ++-
 packages/context-coloring/scripts/dependencies |2 +
 .../scripts/download-dependencies.el   |   51 ---
 .../context-coloring/test/context-coloring-test.el |  173 +---
 .../test/fixtures/comments-and-strings.js  |1 +
 8 files changed, 213 insertions(+), 95 deletions(-)

diff --git a/packages/context-coloring/Makefile 
b/packages/context-coloring/Makefile
index c265382..3a6a0be 100644
--- a/packages/context-coloring/Makefile
+++ b/packages/context-coloring/Makefile
@@ -25,7 +25,8 @@ clean: uncompile
 
 ${DEPENDENCIES}:
${EMACS} -Q -batch \
-   -l scripts/download-dependencies.el
+   -l scripts/download-dependencies.el \
+   -f download-dependencies
 
 test: ${DEPENDENCIES}
${EMACS} -Q -batch \
diff --git a/packages/context-coloring/README.md 
b/packages/context-coloring/README.md
index ff305c1..7eeacf7 100644
--- a/packages/context-coloring/README.md
+++ b/packages/context-coloring/README.md
@@ -89,6 +89,20 @@ Add the following to your `~/.emacs` file:
 
 ## Customizing
 
+### Options
+
+- `context-coloring-syntactic-comments` (default: `t`): If non-nil, also color
+  comments using `font-lock`.
+- `context-coloring-syntactic-strings` (default: `t`): If non-nil, also color
+  strings using `font-lock`.
+- `context-coloring-delay` (default: `0.25`; supported modes: `js-mode`,
+  `js3-mode`): Delay between a buffer update and colorization.
+- `context-coloring-js-block-scopes` (default: `nil`; supported modes:
+  `js2-mode`): If non-nil, also color block scopes in the scope hierarchy in
+  JavaScript.
+
+### Color Schemes
+
 Color schemes for custom themes are automatically applied when those themes are
 active. Built-in theme support is available for: `ample`, `anti-zenburn`,
 `grandshell`, `leuven`, `monokai`, `solarized`, `spacegray`, `tango` and
@@ -124,13 +138,13 @@ more info on dispatch strategies.)
 A "scopifier" is a CLI program that reads a buffer's contents from stdin and
 writes a JSON array of numbers to stdout. Every three numbers in the array
 represent a range of color. For instance, if I fed the following string of
-JavaScript code to a scopifier,
+JavaScript code to a scopifier:
 
 ```js
 var a = function () {};
 ```
 
-then the scopifier would produce the following array:
+Then the scopifier would produce the following array:
 
 ```js
 [1,24,0,9,23,1]
@@ -175,7 +189,7 @@ required.
 
 [linter]: http://jshint.com/about/
 [flycheck]: http://www.flycheck.org/
-[point]: http://www.gnu.org/software/emacs/manual/html_node/elisp/Point.html
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier
+[point]: http://www.gnu.org/software/emacs/manual/html_node/elisp/Point.html
diff --git a/packages/context-coloring/benchmark/context-coloring-benchmark.el 
b/packages/context-coloring/benchmark/context-coloring-benchmark.el
index 3da8d79..2de5646 100644
--- a/packages/context-coloring/benchmark/context-coloring-benchmark.el
+++ b/packages/context-coloring/benchmark/context-coloring-benchmark.el
@@ -28,8 +28,10 @@
 
 ;;; Code:
 
+(require 'context-coloring)
 (require 'js2-mode)
 
+
 (defconst context-coloring-benchmark-path
   (file-name-directory (or load-file-name buffer-file-name))
   "This file's directory.")
diff --git a/packages/context-coloring/context-coloring.el 
b/packages/context-coloring/context-coloring.el
index 849d392..02537c6 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: 6.0.0
+;; Version: 6.1.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.
@@ -132,16 +132,55 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
end
`(face ,(context-coloring-bounded-level-face level
 
-(defcustom context-coloring-comments-and-strings t
+(defcustom context-coloring-comments-and-strings nil
   "If non-nil, also color comments and strings using `font-lock'."
   :group 'context-coloring)
 
+(make-obsolete-variable
+ 'context-coloring-comments-and-strings
+ "use `context-coloring-syntactic-comments' and
+ `context-coloring-syntactic-strings'

[elpa] master f062d5a 10/11: Version 6.1.0.

2015-03-14 Thread Jackson Ray Hamilton
branch: master
commit f062d5a55496e22cf89f2ef9778a24a840a5a68e
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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

diff --git a/context-coloring.el b/context-coloring.el
index cb64227..02537c6 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: 6.0.0
+;; Version: 6.1.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.



[elpa] master f7230f0 3/5: Merge branch 'versioning'

2015-03-22 Thread Jackson Ray Hamilton
branch: master
commit f7230f089729a0d5b7238476b7915657ac6f179c
Merge: f062d5a dd88ce5
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge branch 'versioning'
---
 context-coloring.el   |  205 ++---
 test/binaries/outta-date  |5 +
 test/context-coloring-test.el |   44 -
 3 files changed, 194 insertions(+), 60 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 02537c6..e09b863 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -62,6 +62,13 @@
   "Reference to this buffer (for timers).")
 
 
+;;; Utilities
+
+(defun context-coloring-join (strings delimiter)
+  "Join a list of STRINGS with the string DELIMITER."
+  (mapconcat 'identity strings delimiter))
+
+
 ;;; Faces
 
 (defun context-coloring-defface (level tty light dark)
@@ -303,12 +310,9 @@ element."
 (delete-process context-coloring-scopifier-process)
 (setq context-coloring-scopifier-process nil)))
 
-(defun context-coloring-scopify-shell-command (command &optional callback)
-  "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'.
-
-Invoke CALLBACK when complete."
+(defun context-coloring-scopify-shell-command (command callback)
+  "Invoke a scopifier via COMMAND, read its response
+asynchronously and invoke CALLBACK with its output."
 
   ;; Prior running tokenization is implicitly obsolete if this function is
   ;; called.
@@ -318,8 +322,7 @@ Invoke CALLBACK when complete."
   (setq context-coloring-scopifier-process
 (start-process-shell-command "scopifier" nil command))
 
-  (let ((output "")
-(buffer context-coloring-buffer))
+  (let ((output ""))
 
 ;; The process may produce output in multiple chunks.  This filter
 ;; accumulates the chunks into a message.
@@ -334,19 +337,34 @@ Invoke CALLBACK when complete."
  context-coloring-scopifier-process
  (lambda (_process event)
(when (equal "finished\n" event)
- (let ((tokens (context-coloring-parse-array output)))
-   (with-current-buffer buffer
- (context-coloring-apply-tokens tokens))
-   (setq context-coloring-scopifier-process nil)
-   (when callback (funcall callback)))
+ (funcall callback output))
 
-  ;; Give the process its input so it can begin.
+(defun context-coloring-send-buffer-to-scopifier ()
+  "Give the scopifier process its input so it can begin
+scopifying."
   (process-send-region
context-coloring-scopifier-process
(point-min) (point-max))
   (process-send-eof
context-coloring-scopifier-process))
 
+(defun context-coloring-scopify-and-colorize (command &optional callback)
+  "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'.
+
+Invoke CALLBACK when complete."
+  (let ((buffer context-coloring-buffer))
+(context-coloring-scopify-shell-command
+ command
+ (lambda (output)
+   (let ((tokens (context-coloring-parse-array output)))
+ (with-current-buffer buffer
+   (context-coloring-apply-tokens tokens))
+ (setq context-coloring-scopifier-process nil)
+ (when callback (funcall callback))
+  (context-coloring-send-buffer-to-scopifier))
+
 
 ;;; Dispatch
 
@@ -395,6 +413,11 @@ buffer a returns a flat vector of start, end and level 
data.
 sent via stdin, and with a flat JSON array of start, end and
 level data returned via stdout.
 
+`:version' - Minimum required version that should be printed when
+executing `:command' with a \"--version\" flag.  The version
+should be numeric, e.g. \"2\", \"19700101\", \"1.2.3\",
+\"v1.2.3\" etc.
+
 `:setup' - Arbitrary code to set up this dispatch when
 `context-coloring-mode' is enabled.
 
@@ -419,7 +442,8 @@ level data returned via stdout.
  'javascript-node
  :modes '(js-mode js3-mode)
  :executable "scopifier"
- :command "scopifier")
+ :command "scopifier"
+ :version "v1.1.1")
 
 (context-coloring-define-dispatch
  'javascript-js2
@@ -438,27 +462,19 @@ the current buffer, then execute it.
 
 Invoke 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)))
-(when (null dispatch)
-  (message "%s" "Context coloring is not available for this major mode"))
-(let (colorizer
-  scopifier
-  command
-  executable)
-  (cond

[elpa] master 233abf8 5/5: Merge commit '901db7732bf61d9809712e8adfad9f84adc2eb56' from context-coloring

2015-03-22 Thread Jackson Ray Hamilton
branch: master
commit 233abf8df3d0750692f5edea2a0f1fb4b7746a29
Merge: 3f035ad 901db77
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge commit '901db7732bf61d9809712e8adfad9f84adc2eb56' from 
context-coloring
---
 packages/context-coloring/context-coloring.el  |  207 ++--
 packages/context-coloring/test/binaries/outta-date |5 +
 .../context-coloring/test/context-coloring-test.el |   44 -
 3 files changed, 195 insertions(+), 61 deletions(-)

diff --git a/packages/context-coloring/context-coloring.el 
b/packages/context-coloring/context-coloring.el
index 02537c6..cd1b97a 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: 6.1.0
+;; Version: 6.2.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.
@@ -62,6 +62,13 @@
   "Reference to this buffer (for timers).")
 
 
+;;; Utilities
+
+(defun context-coloring-join (strings delimiter)
+  "Join a list of STRINGS with the string DELIMITER."
+  (mapconcat 'identity strings delimiter))
+
+
 ;;; Faces
 
 (defun context-coloring-defface (level tty light dark)
@@ -303,12 +310,9 @@ element."
 (delete-process context-coloring-scopifier-process)
 (setq context-coloring-scopifier-process nil)))
 
-(defun context-coloring-scopify-shell-command (command &optional callback)
-  "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'.
-
-Invoke CALLBACK when complete."
+(defun context-coloring-scopify-shell-command (command callback)
+  "Invoke a scopifier via COMMAND, read its response
+asynchronously and invoke CALLBACK with its output."
 
   ;; Prior running tokenization is implicitly obsolete if this function is
   ;; called.
@@ -318,8 +322,7 @@ Invoke CALLBACK when complete."
   (setq context-coloring-scopifier-process
 (start-process-shell-command "scopifier" nil command))
 
-  (let ((output "")
-(buffer context-coloring-buffer))
+  (let ((output ""))
 
 ;; The process may produce output in multiple chunks.  This filter
 ;; accumulates the chunks into a message.
@@ -334,19 +337,34 @@ Invoke CALLBACK when complete."
  context-coloring-scopifier-process
  (lambda (_process event)
(when (equal "finished\n" event)
- (let ((tokens (context-coloring-parse-array output)))
-   (with-current-buffer buffer
- (context-coloring-apply-tokens tokens))
-   (setq context-coloring-scopifier-process nil)
-   (when callback (funcall callback)))
+ (funcall callback output))
 
-  ;; Give the process its input so it can begin.
+(defun context-coloring-send-buffer-to-scopifier ()
+  "Give the scopifier process its input so it can begin
+scopifying."
   (process-send-region
context-coloring-scopifier-process
(point-min) (point-max))
   (process-send-eof
context-coloring-scopifier-process))
 
+(defun context-coloring-scopify-and-colorize (command &optional callback)
+  "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'.
+
+Invoke CALLBACK when complete."
+  (let ((buffer context-coloring-buffer))
+(context-coloring-scopify-shell-command
+ command
+ (lambda (output)
+   (let ((tokens (context-coloring-parse-array output)))
+ (with-current-buffer buffer
+   (context-coloring-apply-tokens tokens))
+ (setq context-coloring-scopifier-process nil)
+ (when callback (funcall callback))
+  (context-coloring-send-buffer-to-scopifier))
+
 
 ;;; Dispatch
 
@@ -395,6 +413,11 @@ buffer a returns a flat vector of start, end and level 
data.
 sent via stdin, and with a flat JSON array of start, end and
 level data returned via stdout.
 
+`:version' - Minimum required version that should be printed when
+executing `:command' with a \"--version\" flag.  The version
+should be numeric, e.g. \"2\", \"19700101\", \"1.2.3\",
+\"v1.2.3\" etc.
+
 `:setup' - Arbitrary code to set up this dispatch when
 `context-coloring-mode' is enabled.
 
@@ -419,7 +442,8 @@ level data returned via stdout.
  'javascript-node
  :modes '(js-mode js3-mode)
  :executable "scopifier"
- :command "scopifier")
+ :command "scopifier"
+ :version "v1.1.1")
 
 (context-coloring-define-dispat

[elpa] master updated (3f035ad -> 233abf8)

2015-03-22 Thread Jackson Ray Hamilton
jackson pushed a change to branch master.

  from  3f035ad   Add 'packages/tiny/' from commit 
'159c3f74e75970808b83fe4b732f180cb76872a3'
   new  522d775   Check scopifier version.
   new  dd88ce5   Cleanup.
   new  f7230f0   Merge branch 'versioning'
   new  901db77   Version 6.2.0.
   new  233abf8   Merge commit '901db7732bf61d9809712e8adfad9f84adc2eb56' 
from context-coloring


Summary of changes:
 packages/context-coloring/context-coloring.el  |  207 ++--
 packages/context-coloring/test/binaries/outta-date |5 +
 .../context-coloring/test/context-coloring-test.el |   44 -
 3 files changed, 195 insertions(+), 61 deletions(-)
 create mode 100755 packages/context-coloring/test/binaries/outta-date



[elpa] master dd88ce5 2/5: Cleanup.

2015-03-22 Thread Jackson Ray Hamilton
branch: master
commit dd88ce5c93068760c76cb7e0fa0424486d37255b
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup.
---
 context-coloring.el   |9 -
 test/context-coloring-test.el |9 ++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ca15c4b..e09b863 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -484,9 +484,7 @@ elisp tracks, and asynchronously for shell command tracks."
 
 Invoke CALLBACK when complete; see `context-coloring-dispatch'."
   (interactive)
-  (context-coloring-dispatch
-   (lambda ()
- (when callback (funcall callback)
+  (context-coloring-dispatch callback))
 
 (defvar-local context-coloring-changed nil
   "Indication that the buffer has changed recently, which implies
@@ -515,7 +513,8 @@ used.")
 produces (1 0 0), \"19700101\" produces (19700101), etc."
   (let (version)
 (while (string-match "[0-9]+" string)
-  (setq version (append version (list (string-to-number (match-string 0 
string)
+  (setq version (append version
+(list (string-to-number (match-string 0 string)
   (setq string (substring string (match-end 0
 version))
 
@@ -988,7 +987,7 @@ Supported modes: `js-mode', `js3-mode'"
   (when colorize-initially-p
 (context-coloring-colorize
 (when (null dispatch)
-  (message "%s" "Context coloring is not available for this major 
mode"))
+  (message "Context coloring is not available for this major 
mode"))
 
 (provide 'context-coloring)
 
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index deada98..cbd2002 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -137,7 +137,8 @@ in the typical format."
 (function-name (intern-soft
 (format "context-coloring-test-js-%s" name)))
 (setup-function-name (intern-soft
-  (format "context-coloring-test-js-%s-setup" 
name
+  (format
+   "context-coloring-test-js-%s-setup" name
 `(ert-deftest-async ,test-name (done)
 (context-coloring-test-js-mode
  ,fixture
@@ -157,7 +158,8 @@ format."
 (function-name (intern-soft
 (format "context-coloring-test-js-%s" name)))
 (setup-function-name (intern-soft
-  (format "context-coloring-test-js-%s-setup" 
name
+  (format
+   "context-coloring-test-js-%s-setup" name
 `(ert-deftest ,test-name ()
(context-coloring-test-js2-mode
 ,fixture
@@ -288,7 +290,8 @@ is FOREGROUND, or the inverse if NEGATE is non-nil."
 "but it %s.")
 level
 (if negate "not " "") foreground
-(if negate "did" (format "was `%s'" 
actual-foreground)))
+(if negate
+"did" (format "was `%s'" actual-foreground)))
 
 (defun context-coloring-test-assert-not-face (&rest arguments)
   "Assert that LEVEL does not have a face with `:foreground'



[elpa] master 901db77 4/5: Version 6.2.0.

2015-03-22 Thread Jackson Ray Hamilton
branch: master
commit 901db7732bf61d9809712e8adfad9f84adc2eb56
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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

diff --git a/context-coloring.el b/context-coloring.el
index e09b863..cd1b97a 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: 6.1.0
+;; Version: 6.2.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.



[elpa] master 522d775 1/5: Check scopifier version.

2015-03-22 Thread Jackson Ray Hamilton
branch: master
commit 522d7755aeab86142ef528678ffcb5a193a48627
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Check scopifier version.
---
 context-coloring.el   |  200 ++---
 test/binaries/outta-date  |5 +
 test/context-coloring-test.el |   35 +++-
 3 files changed, 186 insertions(+), 54 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 02537c6..ca15c4b 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -62,6 +62,13 @@
   "Reference to this buffer (for timers).")
 
 
+;;; Utilities
+
+(defun context-coloring-join (strings delimiter)
+  "Join a list of STRINGS with the string DELIMITER."
+  (mapconcat 'identity strings delimiter))
+
+
 ;;; Faces
 
 (defun context-coloring-defface (level tty light dark)
@@ -303,12 +310,9 @@ element."
 (delete-process context-coloring-scopifier-process)
 (setq context-coloring-scopifier-process nil)))
 
-(defun context-coloring-scopify-shell-command (command &optional callback)
-  "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'.
-
-Invoke CALLBACK when complete."
+(defun context-coloring-scopify-shell-command (command callback)
+  "Invoke a scopifier via COMMAND, read its response
+asynchronously and invoke CALLBACK with its output."
 
   ;; Prior running tokenization is implicitly obsolete if this function is
   ;; called.
@@ -318,8 +322,7 @@ Invoke CALLBACK when complete."
   (setq context-coloring-scopifier-process
 (start-process-shell-command "scopifier" nil command))
 
-  (let ((output "")
-(buffer context-coloring-buffer))
+  (let ((output ""))
 
 ;; The process may produce output in multiple chunks.  This filter
 ;; accumulates the chunks into a message.
@@ -334,19 +337,34 @@ Invoke CALLBACK when complete."
  context-coloring-scopifier-process
  (lambda (_process event)
(when (equal "finished\n" event)
- (let ((tokens (context-coloring-parse-array output)))
-   (with-current-buffer buffer
- (context-coloring-apply-tokens tokens))
-   (setq context-coloring-scopifier-process nil)
-   (when callback (funcall callback)))
+ (funcall callback output))
 
-  ;; Give the process its input so it can begin.
+(defun context-coloring-send-buffer-to-scopifier ()
+  "Give the scopifier process its input so it can begin
+scopifying."
   (process-send-region
context-coloring-scopifier-process
(point-min) (point-max))
   (process-send-eof
context-coloring-scopifier-process))
 
+(defun context-coloring-scopify-and-colorize (command &optional callback)
+  "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'.
+
+Invoke CALLBACK when complete."
+  (let ((buffer context-coloring-buffer))
+(context-coloring-scopify-shell-command
+ command
+ (lambda (output)
+   (let ((tokens (context-coloring-parse-array output)))
+ (with-current-buffer buffer
+   (context-coloring-apply-tokens tokens))
+ (setq context-coloring-scopifier-process nil)
+ (when callback (funcall callback))
+  (context-coloring-send-buffer-to-scopifier))
+
 
 ;;; Dispatch
 
@@ -395,6 +413,11 @@ buffer a returns a flat vector of start, end and level 
data.
 sent via stdin, and with a flat JSON array of start, end and
 level data returned via stdout.
 
+`:version' - Minimum required version that should be printed when
+executing `:command' with a \"--version\" flag.  The version
+should be numeric, e.g. \"2\", \"19700101\", \"1.2.3\",
+\"v1.2.3\" etc.
+
 `:setup' - Arbitrary code to set up this dispatch when
 `context-coloring-mode' is enabled.
 
@@ -419,7 +442,8 @@ level data returned via stdout.
  'javascript-node
  :modes '(js-mode js3-mode)
  :executable "scopifier"
- :command "scopifier")
+ :command "scopifier"
+ :version "v1.1.1")
 
 (context-coloring-define-dispatch
  'javascript-js2
@@ -438,27 +462,19 @@ the current buffer, then execute it.
 
 Invoke 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)))
-(when (null dispatch)
-  (message "%s" "Context coloring is not available for this major mode"))
-(let (colorizer
-  scopifier
-  command
-  executable)
-  (cond
-   ((setq colorizer (plist-get dis

[elpa] master updated (510f0ff -> 8a083d5)

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

  from  510f0ff   Merge commit 'faf966b6b5921074da6b99477e1f0bea29b45f6f'
   new  0888e06   Use Cask and Coveralls.
   new  30f9b0a   Update Cask file.
   new  f9a6dce   Coveralls
   new  a7f5970   Remove unused function.
   new  fd5b9e1   Add tests for versions and disabling.
   new  dd3fe3c   Fix badges.
   new  7a9bd8d   Add async mode startup test.
   new  9873030   Use real keywords.
   new  f11f97f   Make default colors more like font-lock's.
   new  2efebc8   Don't colorize if there are parse errors.
   new  3f63fab   Add local coverage configuration.
   new  d116055   Fix original-maximum-face restoration bug.
   new  85ff3ef   Trailing whitespace, empty arrays, empty strings.
   new  0c20edf   Add coverage for missing lines.
   new  202ca74   Drop `subr-x' dependency.
   new  158fd83   Test the trimming function.
   new  fb53884   Update README.
   new  52da59c   Bust cache.
   new  5dd3035   Refactor trim functions.
   new  8f1af4a   Update library header.
   new  1b6f6fb   Cleanup README.
   new  f8cfd37   Double-space.
   new  55ca15a   Guard against excessively lenghty nodes.
   new  64852e7   Update library headers.
   new  6ee3f82   Refactor coverage.
   new  dbddc45   Reimplement coverage reporter in elisp.
   new  283a006   Version 6.2.1.
   new  8a083d5   Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' 
from context-coloring


Summary of changes:
 packages/context-coloring/.gitignore   |3 +-
 packages/context-coloring/.travis.yml  |2 +
 packages/context-coloring/Cask |9 +
 packages/context-coloring/Makefile |   39 ++--
 packages/context-coloring/README.md|   61 ++---
 .../benchmark/context-coloring-benchmark.el|9 +-
 packages/context-coloring/context-coloring.el  |  104 +---
 packages/context-coloring/scripts/dependencies |2 -
 .../scripts/download-dependencies.el   |   61 -
 .../test/binaries/{outta-date => noop} |2 +-
 .../test/context-coloring-coverage.el  |  154 +++
 .../context-coloring/test/context-coloring-test.el |  276 ---
 .../NEWS => context-coloring/test/fixtures/empty}  |0
 .../test/fixtures/unterminated-comment.js  |6 +
 14 files changed, 515 insertions(+), 213 deletions(-)
 create mode 100644 packages/context-coloring/Cask
 delete mode 100644 packages/context-coloring/scripts/dependencies
 delete mode 100644 packages/context-coloring/scripts/download-dependencies.el
 copy packages/context-coloring/test/binaries/{outta-date => noop} (52%)
 mode change 100755 => 100644
 create mode 100644 packages/context-coloring/test/context-coloring-coverage.el
 copy packages/{load-relative/NEWS => context-coloring/test/fixtures/empty} 
(100%)
 create mode 100644 
packages/context-coloring/test/fixtures/unterminated-comment.js



[elpa] master 2efebc8 10/28: Don't colorize if there are parse errors.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 2efebc8963a71e0455fffacb0c0f3beba3909689
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Don't colorize if there are parse errors.
---
 context-coloring.el |   58 ++
 1 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 853a8e8..c7caa86 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -248,34 +248,36 @@ variable."
 (defun context-coloring-js2-colorize ()
   "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
-(js2-visit-ast
- js2-mode-ast
- (lambda (node end-p)
-   (when (null end-p)
- (cond
-  ((js2-scope-p node)
-   (context-coloring-js2-colorize-node
-node
-(context-coloring-js2-scope-level node)))
-  ((context-coloring-js2-local-name-node-p node)
-   (let* ((enclosing-scope (js2-node-get-enclosing-scope node))
-  (defining-scope (js2-get-defining-scope
-   enclosing-scope
-   (js2-name-node-name node
- ;; The tree seems to be walked lexically, so an entire scope will
- ;; be colored, including its name nodes, before they are reached.
- ;; Coloring the nodes defined in that scope would be redundant, so
- ;; don't do it.
- (when (not (eq defining-scope enclosing-scope))
-   (context-coloring-js2-colorize-node
-node
-(context-coloring-js2-scope-level defining-scope))
- ;; The `t' indicates to search children.
- t)))
-(context-coloring-maybe-colorize-comments-and-strings)))
+  ;; Don't bother trying to color a mangled tree.
+  (when (= 0 (length js2-parsed-errors))
+;; 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
+  (js2-visit-ast
+   js2-mode-ast
+   (lambda (node end-p)
+ (when (null end-p)
+   (cond
+((js2-scope-p node)
+ (context-coloring-js2-colorize-node
+  node
+  (context-coloring-js2-scope-level node)))
+((context-coloring-js2-local-name-node-p node)
+ (let* ((enclosing-scope (js2-node-get-enclosing-scope node))
+(defining-scope (js2-get-defining-scope
+ enclosing-scope
+ (js2-name-node-name node
+   ;; The tree seems to be walked lexically, so an entire scope 
will
+   ;; be colored, including its name nodes, before they are 
reached.
+   ;; Coloring the nodes defined in that scope would be redundant, 
so
+   ;; don't do it.
+   (when (not (eq defining-scope enclosing-scope))
+ (context-coloring-js2-colorize-node
+  node
+  (context-coloring-js2-scope-level defining-scope))
+   ;; The `t' indicates to search children.
+   t)))
+  (context-coloring-maybe-colorize-comments-and-strings
 
 
 ;;; Shell command scopification / colorization



[elpa] master 7a9bd8d 07/28: Add async mode startup test.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 7a9bd8d82cee14afacf7d402bc89595c7afb9286
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add async mode startup test.
---
 context-coloring.el   |8 +++-
 test/context-coloring-test.el |   15 +++
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 5ef09ab..31eb133 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -470,12 +470,18 @@ elisp tracks, and asynchronously for shell command 
tracks."
 
 ;;; Colorization
 
+(defvar context-coloring-colorize-hook nil
+  "Hooks to run after coloring a buffer.")
+
 (defun context-coloring-colorize (&optional callback)
   "Color the current buffer by function context.
 
 Invoke CALLBACK when complete; see `context-coloring-dispatch'."
   (interactive)
-  (context-coloring-dispatch callback))
+  (context-coloring-dispatch
+   (lambda ()
+ (when callback (funcall callback))
+ (run-hooks 'context-coloring-colorize-hook
 
 (defvar-local context-coloring-changed nil
   "Indication that the buffer has changed recently, which implies
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 333a3f3..ede72aa 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -55,6 +55,7 @@
   (setq context-coloring-syntactic-comments nil)
   (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))
 
 (defmacro context-coloring-test-with-fixture (fixture &rest body)
@@ -303,6 +304,20 @@ FOREGROUND.  Apply ARGUMENTS to
 
 ;;; The tests
 
+(ert-deftest-async context-coloring-test-async-mode-startup (done)
+  (context-coloring-test-with-fixture-async
+   "./fixtures/function-scopes.js"
+   (lambda (teardown)
+ (js-mode)
+ (add-hook
+  'context-coloring-colorize-hook
+  (lambda ()
+;; If this runs we are implicitly successful; this test only confirms
+;; that colorization occurs on mode startup.
+(funcall teardown)
+(funcall done)))
+ (context-coloring-mode
+
 (ert-deftest context-coloring-test-check-version ()
   (when (not (context-coloring-check-version "2.1.3" "3.0.1"))
 (ert-fail "Expected version 3.0.1 to satisfy 2.1.3, but it didn't."))



[elpa] master fd5b9e1 05/28: Add tests for versions and disabling.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit fd5b9e16f82ff0689630556eeba702c54d46abf0
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add tests for versions and disabling.
---
 test/binaries/noop|5 +
 test/context-coloring-test.el |   35 +++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/test/binaries/noop b/test/binaries/noop
new file mode 100644
index 000..a35b551
--- /dev/null
+++ b/test/binaries/noop
@@ -0,0 +1,5 @@
+#!/usr/bin/env node
+
+'use strict';
+
+console.log(JSON.stringify([]));
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index cbd2002..333a3f3 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -303,6 +303,12 @@ FOREGROUND.  Apply ARGUMENTS to
 
 ;;; The tests
 
+(ert-deftest context-coloring-test-check-version ()
+  (when (not (context-coloring-check-version "2.1.3" "3.0.1"))
+(ert-fail "Expected version 3.0.1 to satisfy 2.1.3, but it didn't."))
+  (when (context-coloring-check-version "3.0.1" "2.1.3")
+(ert-fail "Expected version 2.1.3 not to satisfy 3.0.1, but it did.")))
+
 (ert-deftest context-coloring-test-unsupported-mode ()
   (context-coloring-test-with-fixture
"./fixtures/function-scopes.js"
@@ -343,6 +349,35 @@ FOREGROUND.  Apply ARGUMENTS to
 (funcall done)))
  (context-coloring-mode
 
+(define-derived-mode
+  context-coloring-test-disable-mode-mode
+  fundamental-mode
+  "Testing"
+  "Prevent `context-coloring-test-disable-mode' from having any
+  unintentional side-effects on mode support.")
+
+(ert-deftest-async context-coloring-test-disable-mode (done)
+  (let (torn-down)
+(context-coloring-define-dispatch
+ 'disable-mode
+ :modes '(context-coloring-test-disable-mode-mode)
+ :executable "node"
+ :command "node test/binaries/noop"
+ :teardown (lambda ()
+ (setq torn-down t)))
+(context-coloring-test-with-fixture-async
+ "./fixtures/function-scopes.js"
+ (lambda (teardown)
+   (unwind-protect
+   (progn
+ (context-coloring-test-disable-mode-mode)
+ (context-coloring-mode)
+ (context-coloring-mode -1)
+ (when (not torn-down)
+   (ert-fail "Expected teardown function to have been called, but 
it wasn't.")))
+ (funcall teardown))
+   (funcall done)
+
 (defvar context-coloring-test-theme-index 0
   "Unique index for unique theme names.")
 



[elpa] master 0888e06 01/28: Use Cask and Coveralls.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 0888e063099ab0126704d893b85710109ccc074a
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Use Cask and Coveralls.
---
 .gitignore   |2 +-
 .travis.yml  |2 +
 Cask |9 +
 Makefile |   24 ++-
 README.md|2 +-
 scripts/dependencies |2 -
 scripts/download-dependencies.el |   61 --
 test/test-helper.el  |3 ++
 8 files changed, 26 insertions(+), 79 deletions(-)

diff --git a/.gitignore b/.gitignore
index f090318..d0147ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
 *.elc
+.cask/
 /benchmark/logs/
-/libraries/
diff --git a/.travis.yml b/.travis.yml
index 2dcc8a6..a732f67 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,6 +15,8 @@ install:
 sudo apt-get update -qq &&
 sudo apt-get install -qq emacs24 emacs24-el;
 fi
+  - curl -fsSL https://raw.github.com/cask/cask/master/go | python
+  - export PATH="/home/travis/.cask/bin:$PATH"
   - npm install -g scopifier
 
 script:
diff --git a/Cask b/Cask
new file mode 100644
index 000..5bdf0cc
--- /dev/null
+++ b/Cask
@@ -0,0 +1,9 @@
+(source melpa)
+
+(package "context-coloring" "6.2.0" "Syntax highlighting, except not for 
syntax.")
+(package-file "context-coloring.el")
+
+(development
+ (depends-on "ert-async")
+ (depends-on "js2-mode")
+ (depends-on "undercover"))
diff --git a/Makefile b/Makefile
index 3a6a0be..87115a0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,33 @@
+CASK = cask
 EMACS = emacs
-DEPENDENCIES = libraries/ert-async.el libraries/js2-mode.el
+DEPENDENCIES = .cask/
 
 all: uncompile compile test
 
 bench: ${DEPENDENCIES}
-   ${EMACS} -Q \
+   ${CASK} exec ${EMACS} -Q \
-L . \
-   -L libraries \
-l context-coloring \
-   -l benchmark/context-coloring-benchmark \
+   -l benchmark/context-coloring-benchmark.el \
-f context-coloring-benchmark-run
 
 compile: ${DEPENDENCIES}
-   ${EMACS} -Q -batch \
+   ${CASK} exec ${EMACS} -Q -batch \
-L . \
-   -L libraries \
-   -f batch-byte-compile *.el libraries/*.el
+   -f batch-byte-compile *.el
 
 uncompile:
-   rm -f *.elc libraries/*.elc
+   rm -f *.elc
 
 clean: uncompile
-   rm -f ${DEPENDENCIES}
+   rm -rf ${DEPENDENCIES}
 
 ${DEPENDENCIES}:
-   ${EMACS} -Q -batch \
-   -l scripts/download-dependencies.el \
-   -f download-dependencies
+   ${CASK}
 
 test: ${DEPENDENCIES}
-   ${EMACS} -Q -batch \
+   ${CASK} exec ${EMACS} -Q -batch \
-L . \
-   -L libraries \
-l ert \
-l ert-async \
-l context-coloring \
diff --git a/README.md b/README.md
index 7eeacf7..eab100e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=develop)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
+# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=develop)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg)](https://coveralls.io/r/jacksonrayhamilton/context-coloring)
 
 
   
diff --git a/scripts/dependencies b/scripts/dependencies
deleted file mode 100644
index c2a9107..000
--- a/scripts/dependencies
+++ /dev/null
@@ -1,2 +0,0 @@
-https://raw.githubusercontent.com/mooz/js2-mode/master/js2-mode.el
-https://raw.githubusercontent.com/rejeep/ert-async.el/master/ert-async.el
diff --git a/scripts/download-dependencies.el b/scripts/download-dependencies.el
deleted file mode 100644
index 2ab24e2..000
--- a/scripts/download-dependencies.el
+++ /dev/null
@@ -1,61 +0,0 @@
-;;; scripts/download-dependencies.el --- Get files for development. -*- 
lexical-binding: t; -*-
-
-;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
-
-;; This file is part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;; Download dependencies for development.
-
-;; Dependencies don't need to be version-controlled. They are also
-;; bleed

[elpa] master 52da59c 18/28: Bust cache.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 52da59c5b021dfeddad260f587dd320080677366
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Bust cache.
---
 README.md |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index 1e84ff2..649ddea 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master)](https://coveralls.io/r/jacksonrayhamilton/context-coloring?branch=master)
+# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master&bust-cache=1)](https://coveralls.io/r/jacksonrayhamilton/context-coloring?branch=master)
 
 
   



[elpa] master 85ff3ef 13/28: Trailing whitespace, empty arrays, empty strings.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 85ff3ef8a80b11810ba4382fd386209d8ec5a714
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Trailing whitespace, empty arrays, empty strings.

Fix bug in the JSON parser.  Arrays only parsed before because
`string-to-number' ignored the trailing "]".
---
 context-coloring.el |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 2b65666..691a475 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -54,6 +54,7 @@
 ;;; Code:
 
 (require 'js2-mode)
+(require 'subr-x)
 
 
 ;;; Local variables
@@ -300,8 +301,13 @@ element."
 
 (defun context-coloring-parse-array (array)
   "Parse ARRAY as a flat JSON array of numbers."
-  (vconcat
-   (mapcar 'string-to-number (split-string (substring array 1 -1) ","
+  (let ((braceless (substring (string-trim array) 1 -1)))
+(cond
+ ((> (length braceless) 0)
+  (vconcat
+   (mapcar 'string-to-number (split-string braceless ","
+ (t
+  (vector)
 
 (defvar-local context-coloring-scopifier-process nil
   "The single scopifier process that can be running.")



[elpa] master dd3fe3c 06/28: Fix badges.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit dd3fe3c700e6559b9d8bf247fb6273a121ec83bc
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix badges.
---
 README.md |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index eab100e..a25db3c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=develop)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg)](https://coveralls.io/r/jacksonrayhamilton/context-coloring)
+# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master)](https://coveralls.io/r/jacksonrayhamilton/context-coloring?branch=master)
 
 
   



[elpa] master f9a6dce 03/28: Coveralls

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit f9a6dce6b08a4ce0c7fb362c0038305828516e59
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Coveralls
---
 Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 87115a0..f322a81 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ test: ${DEPENDENCIES}
-L . \
-l ert \
-l ert-async \
-   -l context-coloring \
+   -l test/test-helper.el \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 



[elpa] master a7f5970 04/28: Remove unused function.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit a7f59701585e054b09de13e3a0272b1a230998aa
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Remove unused function.
---
 context-coloring.el |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index cd1b97a..5ef09ab 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -375,15 +375,6 @@ Invoke CALLBACK when complete."
 (defvar context-coloring-mode-hash-table (make-hash-table :test 'eq)
   "Map major mode names to dispatch property lists.")
 
-(defun context-coloring-select-dispatch (mode dispatch)
-  "Use DISPATCH for MODE."
-  (puthash
-   mode
-   (gethash
-dispatch
-context-coloring-dispatch-hash-table)
-   context-coloring-mode-hash-table))
-
 (defun context-coloring-define-dispatch (symbol &rest properties)
   "Define a new dispatch named SYMBOL with PROPERTIES.
 



[elpa] master fb53884 17/28: Update README.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit fb538848d7328bcd946e1fecd1cd00096b574e5c
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Update README.
---
 README.md |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index a25db3c..1e84ff2 100644
--- a/README.md
+++ b/README.md
@@ -138,19 +138,19 @@ more info on dispatch strategies.)
 A "scopifier" is a CLI program that reads a buffer's contents from stdin and
 writes a JSON array of numbers to stdout. Every three numbers in the array
 represent a range of color. For instance, if I fed the following string of
-JavaScript code to a scopifier:
+JavaScript code to a scopifier
 
 ```js
 var a = function () {};
 ```
 
-Then the scopifier would produce the following array:
+then the scopifier would produce the following array
 
 ```js
 [1,24,0,9,23,1]
 ```
 
-Where, for every three numbers, the first number is a 1-indexed start 
[point][],
+where, for every three numbers, the first number is a 1-indexed start 
[point][],
 the second number is an exclusive end point, and the third number is a scope
 level. The result of applying level 0 coloring to the range [1, 24) and 
then
 applying level 1 coloring to the range [9, 23) would result in the 
following



[elpa] master 64852e7 24/28: Update library headers.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 64852e7bfdf006cc288912bc49659c7bc1fb85f2
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Update library headers.
---
 benchmark/context-coloring-benchmark.el |9 +++--
 test/context-coloring-test.el   |9 +++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/benchmark/context-coloring-benchmark.el 
b/benchmark/context-coloring-benchmark.el
index 2de5646..e020f6f 100644
--- a/benchmark/context-coloring-benchmark.el
+++ b/benchmark/context-coloring-benchmark.el
@@ -1,4 +1,4 @@
-;;; benchmark/context-coloring-benchmark.el --- Benchmarks for context 
coloring. -*- lexical-binding: t; -*-
+;;; context-coloring-benchmark.el --- Benchmarks for context coloring  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
 
@@ -19,12 +19,9 @@
 
 ;;; Commentary:
 
-;; Benchmarks for context-coloring.
+;; 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.
+;; Use with `make bench'.
 
 ;;; Code:
 
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index e220954..b9a43d9 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1,4 +1,4 @@
-;;; test/context-coloring-test.el --- Tests for context coloring. -*- 
lexical-binding: t; -*-
+;;; context-coloring-test.el --- Tests for context coloring  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
 
@@ -19,12 +19,9 @@
 
 ;;; Commentary:
 
-;; Tests for context-coloring.
+;; Tests for context coloring.
 
-;; Tests for both synchronous (elisp) and asynchronous (shell command) coloring
-;; are available.  Basic plugin functionality is also tested.
-
-;; To run, execute `make test' from the project root.
+;; Use with `make test'.
 
 ;;; Code:
 



[elpa] master 9873030 08/28: Use real keywords.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 9873030eb0bb99d57a614b6b26580b6b0e2f1ed0
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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

diff --git a/context-coloring.el b/context-coloring.el
index 31eb133..e7752f5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -4,7 +4,7 @@
 
 ;; Author: Jackson Ray Hamilton 
 ;; URL: https://github.com/jacksonrayhamilton/context-coloring
-;; Keywords: context coloring syntax highlighting
+;; Keywords: convenience faces tools
 ;; Version: 6.2.0
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 



[elpa] master f11f97f 09/28: Make default colors more like font-lock's.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit f11f97f77abeeb1a8bf7e81a04e3576445818194
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Make default colors more like font-lock's.
---
 context-coloring.el |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index e7752f5..853a8e8 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -89,12 +89,12 @@ backgrounds."
   (context-coloring-defface level nil "#3f3f3f" "#cdcdcd"))
 
 (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 1 "yellow"  "#008b8b" "#00")
+(context-coloring-defface 2 "green"   "#ff" "#87cefa")
+(context-coloring-defface 3 "cyan""#483d8b" "#b0c4de")
+(context-coloring-defface 4 "blue""#a020f0" "#eedd82")
+(context-coloring-defface 5 "magenta" "#a0522d" "#98fb98")
+(context-coloring-defface 6 "red" "#228b22" "#7fffd4")
 (context-coloring-defface-neutral 7)
 
 (defvar context-coloring-maximum-face nil



[elpa] master 5dd3035 19/28: Refactor trim functions.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 5dd3035f60d39daf33dd1ff262881911676c659e
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Refactor trim functions.
---
 context-coloring.el |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 010e0af..06c22e9 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -68,16 +68,22 @@
   "Join a list of STRINGS with the string DELIMITER."
   (mapconcat 'identity strings delimiter))
 
-(defun context-coloring-trim (string)
-  "Remove leading and trailing whitespace from STRING."
-  ;; Trim right.
-  (when (string-match "[ \t\n\r]+\\'" string)
-(setq string (replace-match "" t t string)))
-  ;; Trim left.
+(defsubst context-coloring-trim-right (string)
+  "Remove leading whitespace from STRING."
+  (if (string-match "[ \t\n\r]+\\'" string)
+  (replace-match "" t t string)
+string))
+
+(defsubst context-coloring-trim-left (string)
+  "Remove trailing whitespace from STRING."
   (if (string-match "\\`[ \t\n\r]+" string)
   (replace-match "" t t string)
 string))
 
+(defsubst context-coloring-trim (string)
+  "Remove leading and trailing whitespace from STRING."
+  (context-coloring-trim-left (context-coloring-trim-right string)))
+
 
 ;;; Faces
 



[elpa] master 283a006 27/28: Version 6.2.1.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 283a006be8e96c7e011dedddb460b289d335a9fb
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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

diff --git a/context-coloring.el b/context-coloring.el
index c55e6e3..d73773a 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
 
 ;; Author: Jackson Ray Hamilton 
-;; Version: 6.2.0
+;; Version: 6.2.1
 ;; Keywords: convenience faces tools
 ;; Homepage: https://github.com/jacksonrayhamilton/context-coloring
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))



[elpa] master 8f1af4a 20/28: Update library header.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 8f1af4a245d5fcedc3c53df24777e0bdc15df0a8
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Update library header.
---
 context-coloring.el |   31 +++
 1 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 06c22e9..50cbc63 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -1,11 +1,11 @@
-;;; context-coloring.el --- Syntax highlighting, except not for syntax. -*- 
lexical-binding: t; -*-
+;;; context-coloring.el --- Highlight by scope  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
 
 ;; Author: Jackson Ray Hamilton 
-;; URL: https://github.com/jacksonrayhamilton/context-coloring
-;; Keywords: convenience faces tools
 ;; Version: 6.2.0
+;; Keywords: convenience faces tools
+;; Homepage: https://github.com/jacksonrayhamilton/context-coloring
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 
 ;; This file is part of GNU Emacs.
@@ -25,29 +25,20 @@
 
 ;;; Commentary:
 
-;; Highlights code according to function context.
-
-;; - Code in the global scope is one color.  Code in functions within the 
global
-;;   scope is a different color, and code within such functions is another
-;;   color, and so on.
-;; - Identifiers retain the color of the scope in which they are declared.
-
-;; 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.
+;; Highlights code by scope.  Top-level scopes are one color, second-level
+;; scopes are another color, and so on.  Variables retain the color of the 
scope
+;; in which they are defined.  A variable defined in an outer scope referenced
+;; in an inner scope is colored the same as the outer scope.
 
-;; By default, Context Coloring still highlights comments and strings
-;; syntactically.  It is still easy to differentiate code from non-code, and
-;; strings cannot be confused for variables.
+;; By default, comments and strings are still highlighted syntactically.
 
-;; To use, add the following to your ~/.emacs:
+;; To use with js2-mode, add the following to your init file:
 
 ;; (require 'context-coloring)
 ;; (add-hook 'js2-mode-hook 'context-coloring-mode)
 
-;; js-mode or js3-mode support requires Node.js 0.10+ and the scopifier
-;; executable.
+;; To use with js-mode or js3-mode, install Node.js 0.10+ and the scopifier
+;; executable:
 
 ;; $ npm install -g scopifier
 



[elpa] master 3f63fab 11/28: Add local coverage configuration.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 3f63fabe8fbb5135448bb5eb495d2cb9d58e1a68
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add local coverage configuration.
---
 .gitignore  |1 +
 Makefile|   14 +-
 test/{test-helper.el => ci-coverage.el} |0
 test/local-coverage.el  |   42 ++
 test/parse-coverage.js  |   72 +++
 5 files changed, 127 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index d0147ab..a269508 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.elc
 .cask/
 /benchmark/logs/
+/test/coverage/
diff --git a/Makefile b/Makefile
index f322a81..868bd2a 100644
--- a/Makefile
+++ b/Makefile
@@ -30,8 +30,18 @@ test: ${DEPENDENCIES}
-L . \
-l ert \
-l ert-async \
-   -l test/test-helper.el \
+   -l test/ci-coverage.el \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 
-.PHONY: all bench compile uncompile clean test
+cover: ${DEPENDENCIES}
+   COVERALLS_REPO_TOKEN="noop" \
+   ${CASK} exec ${EMACS} -Q -batch \
+   -L . \
+   -l ert \
+   -l ert-async \
+   -l test/local-coverage.el \
+   -l test/context-coloring-test.el \
+   -f ert-run-tests-batch-and-exit
+
+.PHONY: all bench compile uncompile clean test cover
diff --git a/test/test-helper.el b/test/ci-coverage.el
similarity index 100%
rename from test/test-helper.el
rename to test/ci-coverage.el
diff --git a/test/local-coverage.el b/test/local-coverage.el
new file mode 100644
index 000..7d6ee0d
--- /dev/null
+++ b/test/local-coverage.el
@@ -0,0 +1,42 @@
+(defconst context-coloring-test-directory
+  (file-name-directory (or load-file-name buffer-file-name))
+  "This file's directory.")
+
+(defun context-coloring-test-resolve-path (path)
+  "Resolve PATH from this file's directory."
+  (expand-file-name path context-coloring-test-directory))
+
+(defconst context-coloring-coverage-output-file-prefix
+  (format-time-string "%s"))
+
+(defconst context-coloring-coverage-output-file
+  (context-coloring-test-resolve-path
+   (concat "./coverage/" context-coloring-coverage-output-file-prefix 
".json")))
+
+(defconst context-coloring-coverage-report-file
+  (context-coloring-test-resolve-path
+   (concat "./coverage/" context-coloring-coverage-output-file-prefix ".txt")))
+
+(defconst context-coloring-test-coverage-parser
+  (concat "node " (context-coloring-test-resolve-path "./parse-coverage.js")))
+
+(require 'undercover)
+(setq undercover-force-coverage t)
+(make-directory (context-coloring-test-resolve-path "./coverage/") t)
+(undercover "context-coloring.el"
+(:report-file context-coloring-coverage-output-file))
+
+(add-hook
+ 'kill-emacs-hook
+ (lambda ()
+   (let* ((output-buffer (get-buffer-create "*parsed coverage*")))
+ (call-process-shell-command
+  context-coloring-test-coverage-parser
+  context-coloring-coverage-output-file
+  output-buffer)
+ (with-current-buffer output-buffer
+   (princ (buffer-substring-no-properties (point-min) (point-max)))
+   (write-file context-coloring-coverage-report-file
+ t)
+
+(require 'context-coloring)
diff --git a/test/parse-coverage.js b/test/parse-coverage.js
new file mode 100755
index 000..e65eab0
--- /dev/null
+++ b/test/parse-coverage.js
@@ -0,0 +1,72 @@
+#!/usr/bin/env node
+
+// Copyright (C) 2014-2015  Free Software Foundation, Inc.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+'use strict';
+
+var padRight = function (value, padding) {
+return value + new Array(Math.max(0, padding - String(value).length) + 
1).join(' ');
+};
+
+var formatSourceFile = function (sourceFile) {
+var sourceLines = sourceFile.source.split('\n');
+var results = [
+padRight('Hits', 5) + ' | Source',
+new Array(80 + 1).join('-')
+];
+var linesHit = 0;
+var linesHittable = 0;
+results = results.concat(sourceFile.coverage.map(function (hits, index) {
+var hitsValue = hits === null ? 'N/A' : hits;
+var column = hits ===

[elpa] master f8cfd37 22/28: Double-space.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit f8cfd37993890d9fa16f3579a5c306bcfa7de79a
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Double-space.
---
 README.md   |   22 +++---
 context-coloring.el |2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index 664b31b..6c895de 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
 
 Highlights code by scope.  Top-level scopes are one color, second-level scopes
 are another color, and so on.  Variables retain the color of the scope in which
-they are defined.  A variable defined in an outer scope referenced in an inner
+they are defined.  A variable defined in an outer scope referenced by an inner
 scope is colored the same as the outer scope.
 
 By default, comments and strings are still highlighted syntactically.
@@ -87,7 +87,7 @@ Add the following to your init file:
 ### Color Schemes
 
 Color schemes for custom themes are automatically applied when those themes are
-active. Built-in theme support is available for: `ample`, `anti-zenburn`,
+active.  Built-in theme support is available for: `ample`, `anti-zenburn`,
 `grandshell`, `leuven`, `monokai`, `solarized`, `spacegray`, `tango` and
 `zenburn`.
 
@@ -114,13 +114,13 @@ See `C-h f context-coloring-define-theme` for more info 
on theme parameters.
 ## Extending
 
 To add support for a new language, write a "scopifier" for it, and define a new
-coloring dispatch strategy with `context-coloring-define-dispatch`. Then the
-plugin should handle the rest. (See `C-h f context-coloring-define-dispatch` 
for
-more info on dispatch strategies.)
+coloring dispatch strategy with `context-coloring-define-dispatch`.  Then the
+plugin should handle the rest.  (See `C-h f context-coloring-define-dispatch`
+for more info on dispatch strategies.)
 
 A "scopifier" is a CLI program that reads a buffer's contents from stdin and
-writes a JSON array of numbers to stdout. Every three numbers in the array
-represent a range of color. For instance, if I fed the following string of
+writes a JSON array of numbers to stdout.  Every three numbers in the array
+represent a range of color.  For instance, if I fed the following string of
 JavaScript code to a scopifier
 
 ```js
@@ -135,9 +135,9 @@ then the scopifier would produce the following array
 
 where, for every three numbers, the first number is a 1-indexed start 
[point][],
 the second number is an exclusive end point, and the third number is a scope
-level. The result of applying level 0 coloring to the range [1, 24) and 
then
-applying level 1 coloring to the range [9, 23) would result in the 
following
-coloring:
+level.  The result of applying level 0 coloring to the range [1, 24) and
+then applying level 1 coloring to the range [9, 23) would result in the
+following coloring:
 
 
   
@@ -167,7 +167,7 @@ print scopifier ARGF.read
 ```
 
 When a `--version` argument is passed, a scopifier should print its version
-number and exit. This allows context-coloring to determine if an update is
+number and exit.  This allows context-coloring to determine if an update is
 required.
 
 [js2-mode]: https://github.com/mooz/js2-mode
diff --git a/context-coloring.el b/context-coloring.el
index 50cbc63..d7071c9 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -28,7 +28,7 @@
 ;; Highlights code by scope.  Top-level scopes are one color, second-level
 ;; scopes are another color, and so on.  Variables retain the color of the 
scope
 ;; in which they are defined.  A variable defined in an outer scope referenced
-;; in an inner scope is colored the same as the outer scope.
+;; by an inner scope is colored the same as the outer scope.
 
 ;; By default, comments and strings are still highlighted syntactically.
 



[elpa] master dbddc45 26/28: Reimplement coverage reporter in elisp.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit dbddc452d9fa2345659d54f1df571cdc4c7fb1d4
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Reimplement coverage reporter in elisp.
---
 test/context-coloring-coverage.el |   88 +
 test/parse-coverage.js|   72 --
 2 files changed, 79 insertions(+), 81 deletions(-)

diff --git a/test/context-coloring-coverage.el 
b/test/context-coloring-coverage.el
index 0383ac4..2fe8fa9 100644
--- a/test/context-coloring-coverage.el
+++ b/test/context-coloring-coverage.el
@@ -25,6 +25,7 @@
 
 ;;; Code:
 
+(require 'json)
 (require 'undercover)
 
 
@@ -50,8 +51,67 @@
   (concat context-coloring-coverage-output-directory
   context-coloring-coverage-output-file-prefix ".txt"))
 
-(defconst context-coloring-coverage-parser
-  (concat "node " (context-coloring-coverage-resolve-path 
"./parse-coverage.js")))
+(defun context-coloring-coverage-join (strings delimiter)
+  "Join a list of STRINGS with the string DELIMITER."
+  (mapconcat 'identity strings delimiter))
+
+(defun context-coloring-coverage-percentage (dividend divisor)
+  "Get the percentage of DIVIDEND / DIVISOR with precision 2."
+  (let ((percentage (/ (float (round (* (/ (float dividend) divisor) 1))) 
100)))
+(number-to-string
+ (cond
+  ((= (mod percentage 1) 0)
+   ;; Get an integer because we don't like dangling zeros.
+   (round percentage))
+  (t
+   percentage)
+
+(defun context-coloring-coverage-format-source-file (source-file)
+  "Generate a report for SOURCE-FILE's line coverage."
+  (let* ((source-lines (split-string (cdr (assq 'source source-file)) "\n"))
+ (coverage (cdr (assq 'coverage source-file)))
+ (results (list "Hits  | Source"
+(context-coloring-coverage-join (make-vector 80 "-") 
"")))
+ (lines-hit 0)
+ (lines-hittable 0)
+ hits
+ source-line)
+(while coverage
+  (setq hits (car coverage))
+  (setq coverage (cdr coverage))
+  (setq source-line (car source-lines))
+  (setq source-lines (cdr source-lines))
+  (when (not (null hits))
+(setq lines-hittable (+ lines-hittable 1))
+(when (> hits 0)
+  (setq lines-hit (+ lines-hit 1
+  (setq results
+(append results
+(list (format
+   "%-5s %s %s"
+   (if hits hits "N/A")
+   (if (and hits (= hits 0)) "~" "|")
+   source-line)
+(setq results
+  (append results
+  (list
+   ""
+   (format
+"Lines: %s / %s"
+lines-hit
+lines-hittable)
+   (format
+"Coverage: %s%%"
+(context-coloring-coverage-percentage lines-hit 
lines-hittable)
+(context-coloring-coverage-join results "\n")))
+
+(defun context-coloring-coverage-format (coverage-data)
+  "Generate reports for all files in COVERAGE-DATA."
+  (context-coloring-coverage-join
+   (mapcar
+'context-coloring-coverage-format-source-file
+(cdr (assq 'source_files coverage-data)))
+   "\n"))
 
 (defun context-coloring-coverage-local-init ()
   "Initialize test coverage for local viewing."
@@ -63,13 +123,23 @@
   (add-hook
'kill-emacs-hook
(lambda ()
- (let* ((output-buffer (get-buffer-create "*parsed coverage*")))
-   (call-process-shell-command
-context-coloring-coverage-parser
-context-coloring-coverage-output-file
-output-buffer)
-   (with-current-buffer output-buffer
- (princ (buffer-substring-no-properties (point-min) (point-max)))
+ (let (original-json-array-type
+   coverage-data
+   report)
+   (with-temp-buffer
+ (insert-file-contents-literally context-coloring-coverage-output-file)
+ (setq original-json-array-type json-array-type)
+ (setq json-array-type 'list)
+ (setq coverage-data
+   (json-read-from-string
+(buffer-substring-no-properties (point-min) (point-max
+ (setq json-array-type original-json-array-type)
+ (setq report
+   (context-coloring-coverage-format coverage-data))
+ (setq report (concat report "\n")))
+   (princ report)
+   (with-temp-buffer
+ (insert report)
  (write-file context-coloring-coverage-report-file
t)
   (require 'context-coloring))
diff --git a/test/parse-coverage.js b/test/parse-coverage.js
deleted file mode 100755
index e65eab0..00

[elpa] master d116055 12/28: Fix original-maximum-face restoration bug.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit d11605500d0a29ae7718d313469f3ce411979a24
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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 '("#aa"
- "#bb"))
-  (let ((second-theme (context-coloring-test-get-next-theme)))
-(context-coloring-test-deftheme second-theme)
+  (let ((maximum-face-value ))
+(setq context-coloring-maximum-face maximum-face-value)
+(context-coloring-test-deftheme theme)
 (context-coloring-define-theme
- second-theme
- :colors '("#cc"
-   "#dd"
-   "#ee"))
-(let ((third-theme (context-coloring-test-get-next-theme)))
-  (context-coloring-test-deftheme third-theme)
+ theme
+ :colors '("#aa"
+   "#bb"))
+(let ((second-theme (context-coloring-test-get-next-theme)))
+  (context-coloring-test-deftheme second-theme)
   (context-coloring-define-theme
-   third-theme
-   :colors '("#11"
- "#22"
- "#33"
- "#44"))
-  (enable-theme theme)
-  (enable-theme second-theme)
-  (enable-theme third-theme)
-  (disable-theme third-theme)
-  (context-coloring-test-assert-face 0 "#cc")
-  (context-coloring-test-assert-face 1 "#dd")
-  (context-coloring-test-assert-face 2 "#ee")
-  (context-coloring-test-assert-maximum-face 2))
-(disable-theme second-theme)
-(context-coloring-test-assert-face 0 "#aa")
-(context-coloring-test-assert-face 1 "#bb")
-(context-coloring-test-assert-maximum-face 1))
-  (disable-theme theme)
-  (context-coloring-test-assert-not-face 0 "#aa")
-  (context-coloring-test-assert-not-face 1 "#bb")
-  (context-coloring-test-assert

[elpa] master 202ca74 15/28: Drop `subr-x' dependency.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 202ca741433b902f8d723f5789d33c78f93fc115
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Drop `subr-x' dependency.
---
 context-coloring.el |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 691a475..010e0af 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -54,7 +54,6 @@
 ;;; Code:
 
 (require 'js2-mode)
-(require 'subr-x)
 
 
 ;;; Local variables
@@ -69,6 +68,16 @@
   "Join a list of STRINGS with the string DELIMITER."
   (mapconcat 'identity strings delimiter))
 
+(defun context-coloring-trim (string)
+  "Remove leading and trailing whitespace from STRING."
+  ;; Trim right.
+  (when (string-match "[ \t\n\r]+\\'" string)
+(setq string (replace-match "" t t string)))
+  ;; Trim left.
+  (if (string-match "\\`[ \t\n\r]+" string)
+  (replace-match "" t t string)
+string))
+
 
 ;;; Faces
 
@@ -301,7 +310,7 @@ element."
 
 (defun context-coloring-parse-array (array)
   "Parse ARRAY as a flat JSON array of numbers."
-  (let ((braceless (substring (string-trim array) 1 -1)))
+  (let ((braceless (substring (context-coloring-trim array) 1 -1)))
 (cond
  ((> (length braceless) 0)
   (vconcat



[elpa] master 55ca15a 23/28: Guard against excessively lenghty nodes.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 55ca15a37bf816abdc63b02d2ea6f24e835dd2df
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Guard against excessively lenghty nodes.
---
 context-coloring.el   |   69 ++---
 test/context-coloring-test.el |6 +++
 test/fixtures/unterminated-comment.js |6 +++
 3 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index d7071c9..c55e6e3 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -244,47 +244,54 @@ variable."
;; `js2-prop-get-node', so this always works.
(eq node (js2-prop-get-node-right parent
 
+(defvar-local context-coloring-point-max nil
+  "Cached value of `point-max'.")
+
 (defsubst context-coloring-js2-colorize-node (node level)
   "Color NODE with the color for LEVEL."
   (let ((start (js2-node-abs-pos node)))
 (context-coloring-colorize-region
  start
- (+ start (js2-node-len node)) ; End
+ (min
+  ;; End
+  (+ start (js2-node-len node))
+  ;; Somes nodes (like the ast when there is an unterminated multiline
+  ;; comment) will stretch to the value of `point-max'.
+  context-coloring-point-max)
  level)))
 
 (defun context-coloring-js2-colorize ()
   "Color the current buffer using the abstract syntax tree
 generated by `js2-mode'."
-  ;; Don't bother trying to color a mangled tree.
-  (when (= 0 (length js2-parsed-errors))
-;; 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
-  (js2-visit-ast
-   js2-mode-ast
-   (lambda (node end-p)
- (when (null end-p)
-   (cond
-((js2-scope-p node)
- (context-coloring-js2-colorize-node
-  node
-  (context-coloring-js2-scope-level node)))
-((context-coloring-js2-local-name-node-p node)
- (let* ((enclosing-scope (js2-node-get-enclosing-scope node))
-(defining-scope (js2-get-defining-scope
- enclosing-scope
- (js2-name-node-name node
-   ;; The tree seems to be walked lexically, so an entire scope 
will
-   ;; be colored, including its name nodes, before they are 
reached.
-   ;; Coloring the nodes defined in that scope would be redundant, 
so
-   ;; don't do it.
-   (when (not (eq defining-scope enclosing-scope))
- (context-coloring-js2-colorize-node
-  node
-  (context-coloring-js2-scope-level defining-scope))
-   ;; The `t' indicates to search children.
-   t)))
-  (context-coloring-maybe-colorize-comments-and-strings
+  ;; Reset the hash table; the old one could be obsolete.
+  (setq context-coloring-js2-scope-level-hash-table (make-hash-table :test 
'eq))
+  (setq context-coloring-point-max (point-max))
+  (with-silent-modifications
+(js2-visit-ast
+ js2-mode-ast
+ (lambda (node end-p)
+   (when (null end-p)
+ (cond
+  ((js2-scope-p node)
+   (context-coloring-js2-colorize-node
+node
+(context-coloring-js2-scope-level node)))
+  ((context-coloring-js2-local-name-node-p node)
+   (let* ((enclosing-scope (js2-node-get-enclosing-scope node))
+  (defining-scope (js2-get-defining-scope
+   enclosing-scope
+   (js2-name-node-name node
+ ;; The tree seems to be walked lexically, so an entire scope will
+ ;; be colored, including its name nodes, before they are reached.
+ ;; Coloring the nodes defined in that scope would be redundant, so
+ ;; don't do it.
+ (when (not (eq defining-scope enclosing-scope))
+   (context-coloring-js2-colorize-node
+node
+(context-coloring-js2-scope-level defining-scope))
+ ;; The `t' indicates to search children.
+ t)))
+(context-coloring-maybe-colorize-comments-and-strings)))
 
 
 ;;; Shell command scopification / colorization
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 8600e06..e220954 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -985,6 +985,12 @@ see that function."
 (context-coloring-test-deftest-js2-mode syntactic-strings
   :fixture-name comments-and-strings)
 
+;; As long as `add-text-properties' doesn't signal an error, this test passes.
+(defun context-coloring-test-js-unterminated-comment ()
+  "Test unterminated multiline comments.")
+
+(context-color

[elpa] master 0c20edf 14/28: Add coverage for missing lines.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 0c20edfb4c87df9dd95f2f3673ac04baa9bb8a8d
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add coverage for missing lines.
---
 test/context-coloring-test.el |  123 +++-
 1 files changed, 119 insertions(+), 4 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index b9de898..e52886e 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -304,12 +304,28 @@ FOREGROUND.  Apply ARGUMENTS to
   (apply 'context-coloring-test-assert-face
  (append arguments '(t
 
+(defun context-coloring-test-assert-error (body error-message)
+  "Assert that BODY signals ERROR-MESSAGE."
+  (let ((error-signaled-p nil))
+(condition-case err
+(progn
+  (funcall body))
+  (error
+   (setq error-signaled-p t)
+   (when (not (string-equal (cadr err) error-message))
+ (ert-fail (format (concat "Expected the error \"%s\" to be thrown, "
+   "but instead it was \"%s\".")
+   error-message
+   (cadr err))
+(when (not error-signaled-p)
+  (ert-fail "Expected an error to be thrown, but there wasn't."
+
 
 ;;; The tests
 
 (ert-deftest-async context-coloring-test-async-mode-startup (done)
   (context-coloring-test-with-fixture-async
-   "./fixtures/function-scopes.js"
+   "./fixtures/empty"
(lambda (teardown)
  (js-mode)
  (add-hook
@@ -321,6 +337,39 @@ FOREGROUND.  Apply ARGUMENTS to
 (funcall done)))
  (context-coloring-mode
 
+(define-derived-mode
+  context-coloring-change-detection-mode
+  fundamental-mode
+  "Testing"
+  "Prevent `context-coloring-test-change-detection' from
+  having any unintentional side-effects on mode support.")
+
+;; Simply cannot figure out how to trigger an idle timer; would much rather 
test
+;; that.  But (current-idle-time) always returns nil in these tests.
+(ert-deftest-async context-coloring-test-change-detection (done)
+  (context-coloring-define-dispatch
+ 'idle-change
+ :modes '(context-coloring-change-detection-mode)
+ :executable "node"
+ :command "node test/binaries/noop")
+  (context-coloring-test-with-fixture-async
+   "./fixtures/empty"
+   (lambda (teardown)
+ (context-coloring-change-detection-mode)
+ (add-hook
+  'context-coloring-colorize-hook
+  (lambda ()
+(setq context-coloring-colorize-hook nil)
+(add-hook
+ 'context-coloring-colorize-hook
+ (lambda ()
+   (funcall teardown)
+   (funcall done)))
+(insert " ")
+(set-window-buffer (selected-window) (current-buffer))
+(context-coloring-maybe-colorize)))
+ (context-coloring-mode
+
 (ert-deftest context-coloring-test-check-version ()
   (when (not (context-coloring-check-version "2.1.3" "3.0.1"))
 (ert-fail "Expected version 3.0.1 to satisfy 2.1.3, but it didn't."))
@@ -329,13 +378,67 @@ FOREGROUND.  Apply ARGUMENTS to
 
 (ert-deftest context-coloring-test-unsupported-mode ()
   (context-coloring-test-with-fixture
-   "./fixtures/function-scopes.js"
+   "./fixtures/empty"
(context-coloring-mode)
(context-coloring-test-assert-message
 "Context coloring is not available for this major mode"
 "*Messages*")))
 
 (define-derived-mode
+  context-coloring-test-define-dispatch-error-mode
+  fundamental-mode
+  "Testing"
+  "Prevent `context-coloring-test-define-dispatch-error' from
+  having any unintentional side-effects on mode support.")
+
+(ert-deftest context-coloring-test-define-dispatch-error ()
+  (context-coloring-test-assert-error
+   (lambda ()
+ (context-coloring-define-dispatch
+  'define-dispatch-no-modes))
+   "No mode defined for dispatch")
+  (context-coloring-test-assert-error
+   (lambda ()
+ (context-coloring-define-dispatch
+  'define-dispatch-no-strategy
+  :modes '(context-coloring-test-define-dispatch-error-mode)))
+   "No colorizer, scopifier or command defined for dispatch"))
+
+(define-derived-mode
+  context-coloring-test-define-dispatch-scopifier-mode
+  fundamental-mode
+  "Testing"
+  "Prevent `context-coloring-test-define-dispatch-scopifier' from
+  having any unintentional side-effects on mode support.")
+
+(ert-deftest context-coloring-test-define-dispatch-scopifier ()
+  (context-coloring-define-dispatch
+   'define-dispatch-scopifier
+   :modes '(context-coloring-test-define-dispatch-scopifier-mode)
+   :scopifier (lambda () (vector)))
+  (with-temp-buffer
+(context-coloring-test-define-dispatch-scopifie

[elpa] master 30f9b0a 02/28: Update Cask file.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 30f9b0afc474d689e3a1885c29b59c866616991e
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Update Cask file.
---
 Cask |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cask b/Cask
index 5bdf0cc..db61c1c 100644
--- a/Cask
+++ b/Cask
@@ -1,9 +1,9 @@
 (source melpa)
 
-(package "context-coloring" "6.2.0" "Syntax highlighting, except not for 
syntax.")
 (package-file "context-coloring.el")
 
+(depends-on "js2-mode")
+
 (development
  (depends-on "ert-async")
- (depends-on "js2-mode")
  (depends-on "undercover"))



[elpa] master 1b6f6fb 21/28: Cleanup README.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 1b6f6fb975be2141897ea9d7db555f1b2c127c69
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cleanup README.
---
 README.md |   35 ---
 1 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/README.md b/README.md
index 649ddea..664b31b 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,15 @@
-# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master&bust-cache=1)](https://coveralls.io/r/jacksonrayhamilton/context-coloring?branch=master)
+# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master)](https://coveralls.io/r/jacksonrayhamilton/context-coloring?branch=master)
 
 
   
 
 
-Highlights code according to function context.
+Highlights code by scope.  Top-level scopes are one color, second-level scopes
+are another color, and so on.  Variables retain the color of the scope in which
+they are defined.  A variable defined in an outer scope referenced in an inner
+scope is colored the same as the outer scope.
 
-- Code in the global scope is one color. Code in functions within the global
-  scope is a different color, and code within such functions is another color,
-  and so on.
-- Identifiers retain the color of the scope in which they are declared.
-
-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.
-
-By default, context-coloring still highlights comments and strings
-syntactically. It is still easy to differentiate code from non-code, and 
strings
-cannot be confused for variables.
-
-This coloring strategy is probably more useful than conventional syntax
-highlighting. Highlighting keywords can help one to detect spelling errors, but
-a [linter][] could also spot those errors, and if integrated with [flycheck][],
-an extra spot opens up in your editing toolbelt.
-
-Give context-coloring a try; you may find that it *changes the way you write
-code*.
+By default, comments and strings are still highlighted syntactically.
 
 ## Features
 
@@ -61,7 +44,7 @@ cd context-coloring/
 make compile
 ```
 
-- Add the following to your `~/.emacs` file:
+- Add the following to your init file:
 
 ```lisp
 (add-to-list 'load-path "~/.emacs.d/context-coloring")
@@ -76,7 +59,7 @@ npm install -g scopifier
 
 ## Usage
 
-Add the following to your `~/.emacs` file:
+Add the following to your init file:
 
 ```lisp
 ;; non-js2-mode users:
@@ -187,8 +170,6 @@ When a `--version` argument is passed, a scopifier should 
print its version
 number and exit. This allows context-coloring to determine if an update is
 required.
 
-[linter]: http://jshint.com/about/
-[flycheck]: http://www.flycheck.org/
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier



[elpa] master 6ee3f82 25/28: Refactor coverage.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 6ee3f8254b2543f47d40889ff650ec866e65145e
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Refactor coverage.
---
 Makefile  |7 ++-
 test/ci-coverage.el   |3 -
 test/context-coloring-coverage.el |   84 +
 test/local-coverage.el|   42 --
 4 files changed, 88 insertions(+), 48 deletions(-)

diff --git a/Makefile b/Makefile
index 868bd2a..bd82b88 100644
--- a/Makefile
+++ b/Makefile
@@ -30,17 +30,18 @@ test: ${DEPENDENCIES}
-L . \
-l ert \
-l ert-async \
-   -l test/ci-coverage.el \
+   -l test/context-coloring-coverage.el \
+   -f context-coloring-coverage-ci-init \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 
 cover: ${DEPENDENCIES}
-   COVERALLS_REPO_TOKEN="noop" \
${CASK} exec ${EMACS} -Q -batch \
-L . \
-l ert \
-l ert-async \
-   -l test/local-coverage.el \
+   -l test/context-coloring-coverage.el \
+   -f context-coloring-coverage-local-init \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 
diff --git a/test/ci-coverage.el b/test/ci-coverage.el
deleted file mode 100644
index 1c97075..000
--- a/test/ci-coverage.el
+++ /dev/null
@@ -1,3 +0,0 @@
-(require 'undercover)
-(undercover "context-coloring.el")
-(require 'context-coloring)
diff --git a/test/context-coloring-coverage.el 
b/test/context-coloring-coverage.el
new file mode 100644
index 000..0383ac4
--- /dev/null
+++ b/test/context-coloring-coverage.el
@@ -0,0 +1,84 @@
+;;; context-coloring-coverage.el --- Test coverage for context coloring  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Test coverage support for context coloring.
+
+;; Use with `make cover'.
+
+;;; Code:
+
+(require 'undercover)
+
+
+(defconst context-coloring-coverage-directory
+  (file-name-directory (or load-file-name buffer-file-name))
+  "This file's directory.")
+
+(defun context-coloring-coverage-resolve-path (path)
+  "Resolve PATH from this file's directory."
+  (expand-file-name path context-coloring-coverage-directory))
+
+(defconst context-coloring-coverage-output-file-prefix
+  (format-time-string "%s"))
+
+(defconst context-coloring-coverage-output-directory
+  (context-coloring-coverage-resolve-path "./coverage/"))
+
+(defconst context-coloring-coverage-output-file
+  (concat context-coloring-coverage-output-directory
+  context-coloring-coverage-output-file-prefix ".json"))
+
+(defconst context-coloring-coverage-report-file
+  (concat context-coloring-coverage-output-directory
+  context-coloring-coverage-output-file-prefix ".txt"))
+
+(defconst context-coloring-coverage-parser
+  (concat "node " (context-coloring-coverage-resolve-path 
"./parse-coverage.js")))
+
+(defun context-coloring-coverage-local-init ()
+  "Initialize test coverage for local viewing."
+  (make-directory context-coloring-coverage-output-directory t)
+  (setq undercover-force-coverage t)
+  (setenv "COVERALLS_REPO_TOKEN" "noop")
+  (undercover "context-coloring.el"
+  (:report-file context-coloring-coverage-output-file))
+  (add-hook
+   'kill-emacs-hook
+   (lambda ()
+ (let* ((output-buffer (get-buffer-create "*parsed coverage*")))
+   (call-process-shell-command
+context-coloring-coverage-parser
+context-coloring-coverage-output-file
+output-buffer)
+   (with-current-buffer output-buffer
+ (princ (buffer-substring-no-properties (point-min) (point-max)))
+ (write-file context-coloring-coverage-report-file
+   t)
+  (require 'context-coloring))
+
+(defun context-coloring-coverage-ci-init ()
+  "Initialize test coverage for continuous integration."
+  (undercover "context-coloring.el")
+  (require 'context-coloring))
+
+(provide 'context-coloring-coverage)
+
+;; context-coloring-coverage.el ends here
diff --git a/test/local-coverage.el

[elpa] master 8a083d5 28/28: Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' from context-coloring

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 8a083d5bfb1e4c97880879569a43d1eaa22f43db
Merge: 510f0ff 283a006
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' from 
context-coloring
---
 packages/context-coloring/.gitignore   |3 +-
 packages/context-coloring/.travis.yml  |2 +
 packages/context-coloring/Cask |9 +
 packages/context-coloring/Makefile |   39 ++--
 packages/context-coloring/README.md|   61 ++---
 .../benchmark/context-coloring-benchmark.el|9 +-
 packages/context-coloring/context-coloring.el  |  104 +---
 packages/context-coloring/scripts/dependencies |2 -
 .../scripts/download-dependencies.el   |   61 -
 packages/context-coloring/test/binaries/noop   |5 +
 .../test/context-coloring-coverage.el  |  154 +++
 .../context-coloring/test/context-coloring-test.el |  276 ---
 .../test/fixtures/unterminated-comment.js  |6 +
 13 files changed, 519 insertions(+), 212 deletions(-)

diff --git a/packages/context-coloring/.gitignore 
b/packages/context-coloring/.gitignore
index f090318..a269508 100644
--- a/packages/context-coloring/.gitignore
+++ b/packages/context-coloring/.gitignore
@@ -1,3 +1,4 @@
 *.elc
+.cask/
 /benchmark/logs/
-/libraries/
+/test/coverage/
diff --git a/packages/context-coloring/.travis.yml 
b/packages/context-coloring/.travis.yml
index 2dcc8a6..a732f67 100644
--- a/packages/context-coloring/.travis.yml
+++ b/packages/context-coloring/.travis.yml
@@ -15,6 +15,8 @@ install:
 sudo apt-get update -qq &&
 sudo apt-get install -qq emacs24 emacs24-el;
 fi
+  - curl -fsSL https://raw.github.com/cask/cask/master/go | python
+  - export PATH="/home/travis/.cask/bin:$PATH"
   - npm install -g scopifier
 
 script:
diff --git a/packages/context-coloring/Cask b/packages/context-coloring/Cask
new file mode 100644
index 000..db61c1c
--- /dev/null
+++ b/packages/context-coloring/Cask
@@ -0,0 +1,9 @@
+(source melpa)
+
+(package-file "context-coloring.el")
+
+(depends-on "js2-mode")
+
+(development
+ (depends-on "ert-async")
+ (depends-on "undercover"))
diff --git a/packages/context-coloring/Makefile 
b/packages/context-coloring/Makefile
index 3a6a0be..bd82b88 100644
--- a/packages/context-coloring/Makefile
+++ b/packages/context-coloring/Makefile
@@ -1,41 +1,48 @@
+CASK = cask
 EMACS = emacs
-DEPENDENCIES = libraries/ert-async.el libraries/js2-mode.el
+DEPENDENCIES = .cask/
 
 all: uncompile compile test
 
 bench: ${DEPENDENCIES}
-   ${EMACS} -Q \
+   ${CASK} exec ${EMACS} -Q \
-L . \
-   -L libraries \
-l context-coloring \
-   -l benchmark/context-coloring-benchmark \
+   -l benchmark/context-coloring-benchmark.el \
-f context-coloring-benchmark-run
 
 compile: ${DEPENDENCIES}
-   ${EMACS} -Q -batch \
+   ${CASK} exec ${EMACS} -Q -batch \
-L . \
-   -L libraries \
-   -f batch-byte-compile *.el libraries/*.el
+   -f batch-byte-compile *.el
 
 uncompile:
-   rm -f *.elc libraries/*.elc
+   rm -f *.elc
 
 clean: uncompile
-   rm -f ${DEPENDENCIES}
+   rm -rf ${DEPENDENCIES}
 
 ${DEPENDENCIES}:
-   ${EMACS} -Q -batch \
-   -l scripts/download-dependencies.el \
-   -f download-dependencies
+   ${CASK}
 
 test: ${DEPENDENCIES}
-   ${EMACS} -Q -batch \
+   ${CASK} exec ${EMACS} -Q -batch \
-L . \
-   -L libraries \
-l ert \
-l ert-async \
-   -l context-coloring \
+   -l test/context-coloring-coverage.el \
+   -f context-coloring-coverage-ci-init \
+   -l test/context-coloring-test.el \
+   -f ert-run-tests-batch-and-exit
+
+cover: ${DEPENDENCIES}
+   ${CASK} exec ${EMACS} -Q -batch \
+   -L . \
+   -l ert \
+   -l ert-async \
+   -l test/context-coloring-coverage.el \
+   -f context-coloring-coverage-local-init \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
 
-.PHONY: all bench compile uncompile clean test
+.PHONY: all bench compile uncompile clean test cover
diff --git a/packages/context-coloring/README.md 
b/packages/context-coloring/README.md
index 7eeacf7..6c895de 100644
--- a/packages/context-coloring/README.md
+++ b/packages/context-coloring/README.md
@@ -1,32 +1,15 @@
-# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=develop)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
+# Context Coloring [![Build 
Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
 [![Coverage 
Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master)](https://coveralls.io/r/jacksonrayh

[elpa] master 158fd83 16/28: Test the trimming function.

2015-05-05 Thread Jackson Ray Hamilton
branch: master
commit 158fd8328570250fcaafcdf77c1f08a72fe99b62
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Test the trimming function.
---
 test/context-coloring-test.el |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index e52886e..8600e06 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -320,9 +320,21 @@ FOREGROUND.  Apply ARGUMENTS to
 (when (not error-signaled-p)
   (ert-fail "Expected an error to be thrown, but there wasn't."
 
+(defun context-coloring-test-assert-trimmed (result expected)
+  (when (not (string-equal result expected))
+(ert-fail "Expected string to be trimmed, but it wasn't.")))
+
 
 ;;; The tests
 
+(ert-deftest context-coloring-test-trim ()
+  (context-coloring-test-assert-trimmed (context-coloring-trim "") "")
+  (context-coloring-test-assert-trimmed (context-coloring-trim " ") "")
+  (context-coloring-test-assert-trimmed (context-coloring-trim "a") "a")
+  (context-coloring-test-assert-trimmed (context-coloring-trim " a") "a")
+  (context-coloring-test-assert-trimmed (context-coloring-trim "a ") "a")
+  (context-coloring-test-assert-trimmed (context-coloring-trim " a ") "a"))
+
 (ert-deftest-async context-coloring-test-async-mode-startup (done)
   (context-coloring-test-with-fixture-async
"./fixtures/empty"



[elpa] master updated (e42b97b -> b525e2d)

2015-05-18 Thread Jackson Ray Hamilton
jackson pushed a change to branch master.

  from  e42b97b   Update seq.el to version 1.7
   new  056be97   Add URL to header.
   new  eb429df   Use lowercase for hex codes.
   new  d9d901f   Add basic elisp defun coloring.
   new  5e34bec   Cover malformed defun cases.
   new  8919acd   Add lambda coloring.
   new  62506ae   Add quote and number coloring.
   new  636e6b9   Add elisp comments and strings support.
   new  284cfa6   Don't treat unbindables like variables.
   new  3e3141f   Refactor elisp tests to use visual assertions.
   new  5acd088   Add non-recursive let* coloring.
   new  58b7474   Don't color function calls as level 0.
   new  dd8d491   Also color defsubst.
   new  171883f   Add let coloring.
   new  b4072c1   Trivial refactoring for clarity.
   new  c830ae5   Fix let* test.
   new  ea3ff31   Pass let* test.
   new  926d74a   Include binding order in let* test.
   new  29328af   Add let test.
   new  b28e896   Add complex nesting to let test.
   new  bd9c147   Ignore the dot.
   new  d7b2c92   Remove unused functions.
   new  0836b9f   Add change hooks for elisp.
   new  08bf3e4   Ignore question marks.
   new  09ec36e   Add interruption mechanism.
   new  dc2f9a6   Refactor maybe-colorize-comments-and-strings.
   new  a556195   Tweak iteration values, add logging.
   new  3fc5b20   Make dispatches fully redefinable.
   new  89f20e4   Improve interruptability of syntactic coloring.
   new  ef544ef   Fontify keywords.
   new  07c5852   Add idle change teardown function.
   new  d24de46   Add TODO.
   new  5c5b429   Fix font-lock error.
   new  c0a6689   Only set defaults when the mode is enabled.
   new  59a6c8e   Fix timer disposal and timer buffer detection.
   new  88a921f   Improve defun regexp.
   new  438cb33   Fix incorrect last fontified position.
   new  1d7761c   Add constant comment test.
   new  4bbce56   Add test for interruption.
   new  4ff6e82   Remove verbose parsing.
   new  6392d1f   Bind optional parameters earlier.
   new  708276e   Compiler micro-optimizations.
   new  5051a70   Update documentation for emacs lisp.
   new  6a4ad31   Add derived mode support.
   new  3b6a391   Minor cleanup.
   new  c6e173b   Merge branch 'elisp'
   new  3bf805d   Version 6.3.0.
   new  b525e2d   Merge commit '3bf805df83fe6f110f3e7e8ce2dc37e0cf6c14cb' 
from context-coloring


Summary of changes:
 packages/context-coloring/README.md|   46 +-
 packages/context-coloring/context-coloring.el  |  751 
 .../context-coloring/test/context-coloring-test.el |  275 +++-
 packages/context-coloring/test/fixtures/comment.el |3 +
 packages/context-coloring/test/fixtures/defun.el   |7 +
 packages/context-coloring/test/fixtures/ignored.el |2 +
 .../context-coloring/test/fixtures/iteration.el|2 +
 packages/context-coloring/test/fixtures/lambda.el  |3 +
 packages/context-coloring/test/fixtures/let*.el|   11 +
 packages/context-coloring/test/fixtures/let.el |8 +
 packages/context-coloring/test/fixtures/quote.el   |4 +
 packages/context-coloring/test/fixtures/string.el  |2 +
 12 files changed, 947 insertions(+), 167 deletions(-)
 create mode 100644 packages/context-coloring/test/fixtures/comment.el
 create mode 100644 packages/context-coloring/test/fixtures/defun.el
 create mode 100644 packages/context-coloring/test/fixtures/ignored.el
 create mode 100644 packages/context-coloring/test/fixtures/iteration.el
 create mode 100644 packages/context-coloring/test/fixtures/lambda.el
 create mode 100644 packages/context-coloring/test/fixtures/let*.el
 create mode 100644 packages/context-coloring/test/fixtures/let.el
 create mode 100644 packages/context-coloring/test/fixtures/quote.el
 create mode 100644 packages/context-coloring/test/fixtures/string.el



[elpa] master 8919acd 05/47: Add lambda coloring.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 8919acd4b2c2104ed2538dbe9835befe361dec3b
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add lambda coloring.
---
 context-coloring.el   |   76 ++---
 test/context-coloring-test.el |   11 ++
 test/fixtures/lambda.el   |3 ++
 3 files changed, 55 insertions(+), 35 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 6954b10..5f443dd 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -344,6 +344,7 @@ generated by `js2-mode'."
  (scope-stack `(,(context-coloring-make-scope -1 0))) ; -1 never 
matches a depth
  one-word-found-p
  in-defun-p
+ in-lambda-p
  function-call-p
  defun-arglist
  defun-arg
@@ -390,15 +391,18 @@ generated by `js2-mode'."
   (setq child-0-string (buffer-substring-no-properties child-0-pos 
child-0-end))
   (cond
((string-match-p "defun\\|defmacro" child-0-string)
-(setq in-defun-p t)
-(setq scope-stack (cons (context-coloring-make-scope
- (nth 0 ppss)
- (1+ (context-coloring-scope-get-level
-  (car scope-stack
-scope-stack)))
+(setq in-defun-p t))
+   ((string-match-p "lambda" child-0-string)
+(setq in-lambda-p t))
;; Assume a global function call
(t
 (setq function-call-p t)
+(when (or in-defun-p in-lambda-p)
+  (setq scope-stack (cons (context-coloring-make-scope
+   (nth 0 ppss)
+   (1+ (context-coloring-scope-get-level
+(car scope-stack
+  scope-stack)))
 ;; TODO: Probably redundant and wasteful
 (context-coloring-colorize-region token-pos
   (scan-sexps token-pos 1)
@@ -408,38 +412,40 @@ generated by `js2-mode'."
   (context-coloring-colorize-region child-0-pos child-0-end 0)
   (setq function-call-p nil))
 (cond
- (in-defun-p
+ ((or in-defun-p in-lambda-p)
   (goto-char child-0-end)
-  ;; Lookahead for defun name
-  (skip-syntax-forward " " end)
-  (setq child-1-pos (point))
-  (setq child-1-syntax (syntax-after child-1-pos))
-  (setq child-1-syntax-code (logand #x (car child-1-syntax)))
-  (cond
-   ;; Word
-   ((context-coloring-emacs-lisp-identifier-syntax-p 
child-1-syntax-code)
-(setq child-1-end (scan-sexps child-1-pos 1))
-;; defuns are global so use level 0
-(context-coloring-colorize-region child-1-pos child-1-end 0)
-(goto-char child-1-end)
-;; Lookahead for parameters
+  (when in-defun-p
+;; Lookahead for defun name
 (skip-syntax-forward " " end)
-(when (= 4 (logand #x (car (syntax-after (point)
-  (setq child-2-end (scan-sexps (point) 1))
-  (setq defun-arglist (read (buffer-substring-no-properties
- (point)
- child-2-end)))
-  (while defun-arglist
-(setq defun-arg (car defun-arglist))
-(when (and (symbolp defun-arg)
-   (string-match-p "\\`[^&:]" (symbol-name 
defun-arg)))
-  (context-coloring-scope-add-variable
-   (car scope-stack)
-   defun-arg))
-(setq defun-arglist (cdr defun-arglist)))
-  (goto-char child-2-end
+(setq child-1-pos (point))
+(setq child-1-syntax (syntax-after child-1-pos))
+(setq child-1-syntax-code (logand #x (car child-1-syntax)))
+(cond
+ ;; Word
+ ((context-coloring-emacs-lisp-identifier-syntax-p 
child-1-syntax-code)
+  (setq child-1-end (scan-sexps child-1-pos 1))
+  ;; defuns are global so use level 0
+  (context-coloring-colorize-region child-1-pos child-1-end 0)
+  (goto-char child-1-end
+  ;; Lookahead for parameters
+  (skip-syntax-forward " " end)
+  (when (= 4 (logand #x (car (syntax-after (point)
+(setq child-2-end (sca

[elpa] master 056be97 01/47: Add URL to header.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 056be97c4ebf24fa06d4d09407692f43c69b614d
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add URL to header.
---
 context-coloring.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index d73773a..d32a27d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -5,8 +5,8 @@
 ;; Author: Jackson Ray Hamilton 
 ;; Version: 6.2.1
 ;; Keywords: convenience faces tools
-;; Homepage: https://github.com/jacksonrayhamilton/context-coloring
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
+;; URL: https://github.com/jacksonrayhamilton/context-coloring
 
 ;; This file is part of GNU Emacs.
 



[elpa] master 171883f 13/47: Add let coloring.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 171883fa4f044bc5c4acf0042531f1b160a8e7d6
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add let coloring.
---
 context-coloring.el |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index a84a1b4..9c31314 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -375,6 +375,7 @@ generated by `js2-mode'."
  one-word-found-p
  in-defun-p
  in-lambda-p
+ in-let-p
  in-let*-p
  defun-arglist
  defun-arg
@@ -472,10 +473,13 @@ generated by `js2-mode'."
 (setq in-defun-p t))
((string-match-p "\\`lambda\\'" child-0-string)
 (setq in-lambda-p t))
+   ((string-match-p "\\`let\\'" child-0-string)
+(setq in-let-p t))
((string-match-p "\\`let\\*\\'" child-0-string)
 (setq in-let*-p t)
 (when (or in-defun-p
   in-lambda-p
+  in-let-p
   in-let*-p)
   (setq scope-stack (cons (context-coloring-make-scope
(nth 0 ppss)
@@ -524,7 +528,8 @@ generated by `js2-mode'."
   ;; Cleanup
   (setq in-defun-p nil)
   (setq in-lambda-p nil))
- (in-let*-p
+ ((or in-let-p
+  in-let*-p)
   (goto-char child-0-end)
   ;; Lookahead for bindings
   (context-coloring-forward-sws)
@@ -552,6 +557,7 @@ generated by `js2-mode'."
   (setq let-varlist (cdr let-varlist)))
 (goto-char child-1-end))
   ;; Cleanup
+  (setq in-let-p nil)
   (setq in-let*-p nil))
  (t
   (goto-char (cond



[elpa] master 636e6b9 07/47: Add elisp comments and strings support.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 636e6b9e655724be822605cb2971a2110bbd215f
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add elisp comments and strings support.
---
 context-coloring.el   |   22 ++-
 test/context-coloring-test.el |  132 +
 test/fixtures/comment.el  |3 +
 test/fixtures/string.el   |2 +
 4 files changed, 104 insertions(+), 55 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index d5da9da..92e4578 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -345,6 +345,10 @@ generated by `js2-mode'."
   (or (= 2 syntax-code)
   (= 3 syntax-code)))
 
+(defun context-coloring-forward-sws ()
+  "Move forward through whitespace and comments."
+  (while (forward-comment 1)))
+
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
   (with-silent-modifications
@@ -395,6 +399,18 @@ generated by `js2-mode'."
 (1+ token-pos
   (cond
 
+   ;; Resolve invalid state
+   ((cond
+ ;; Inside string?
+ ((nth 3 ppss)
+  (skip-syntax-forward "^\"" end)
+  (forward-char)
+  t)
+ ;; Inside comment?
+ ((nth 4 ppss)
+  (skip-syntax-forward "^>" end) ; comment ender
+  t)))
+
;; Expression prefix
;; Has to come first in case of commas
((= 6 token-syntax-code)
@@ -426,7 +442,7 @@ generated by `js2-mode'."
((= 4 token-syntax-code)
 (forward-char)
 ;; Lookahead for scopes / function calls
-(skip-syntax-forward " " end)
+(context-coloring-forward-sws)
 (setq child-0-pos (point))
 (setq child-0-syntax (syntax-after child-0-pos))
 (setq child-0-syntax-code (logand #x (car child-0-syntax)))
@@ -463,7 +479,7 @@ generated by `js2-mode'."
   (goto-char child-0-end)
   (when in-defun-p
 ;; Lookahead for defun name
-(skip-syntax-forward " " end)
+(context-coloring-forward-sws)
 (setq child-1-pos (point))
 (setq child-1-syntax (syntax-after child-1-pos))
 (setq child-1-syntax-code (logand #x (car child-1-syntax)))
@@ -475,7 +491,7 @@ generated by `js2-mode'."
   (context-coloring-colorize-region child-1-pos child-1-end 0)
   (goto-char child-1-end
   ;; Lookahead for parameters
-  (skip-syntax-forward " " end)
+  (context-coloring-forward-sws)
   (when (= 4 (logand #x (car (syntax-after (point)
 (setq child-2-end (scan-sexps (point) 1))
 (setq defun-arglist (read (buffer-substring-no-properties
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 95c52e0..192d2ef 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -44,13 +44,12 @@
 
 (defun context-coloring-test-setup ()
   "Prepare before all tests."
-  (setq context-coloring-comments-and-strings nil))
+  (setq context-coloring-syntactic-comments nil)
+  (setq context-coloring-syntactic-strings nil))
 
 (defun context-coloring-test-cleanup ()
   "Cleanup after all tests."
-  (setq context-coloring-comments-and-strings t)
-  (setq context-coloring-syntactic-comments nil)
-  (setq context-coloring-syntactic-strings nil)
+  (setq context-coloring-comments-and-strings nil)
   (setq context-coloring-js-block-scopes nil)
   (setq context-coloring-colorize-hook nil)
   (setq context-coloring-check-scopifier-version-hook nil)
@@ -167,24 +166,22 @@ format."
 ',setup-function-name
 (,function-name)
 
-(defmacro context-coloring-test-emacs-lisp-mode (fixture &rest body)
-  "Use FIXTURE as the subject matter for test logic in BODY."
-  `(context-coloring-test-with-fixture
-,fixture
-(emacs-lisp-mode)
-(context-coloring-mode)
-,@body))
-
-(defmacro context-coloring-test-deftest-emacs-lisp-mode (name &rest body)
+(cl-defmacro context-coloring-test-deftest-emacs-lisp-mode (name
+body
+&key setup)
   "Define a test for `emacs-lisp-mode' with name and fixture as
-NAME, with BODY containing the assertions."
+NAME, with BODY containing the assertions, and SETUP defining the
+environment."
   (declare (indent defun))
   (let ((test-name (intern (format "context-coloring-emacs-lisp-mode-%s" 
name)))
 (fixture (format "./fixtures/%s.el" name)))
 `

[elpa] master 3e3141f 09/47: Refactor elisp tests to use visual assertions.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 3e3141fd99a4a8662a1ed5777d0e8262a279974c
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Refactor elisp tests to use visual assertions.
---
 test/context-coloring-test.el |  163 +++--
 test/fixtures/lambda.el   |4 +-
 2 files changed, 110 insertions(+), 57 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 8e5b699..93e0517 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -186,6 +186,87 @@ environment."
 
 ;;; Assertion functions
 
+(defun context-coloring-test-assert-position-level (position level)
+  "Assert that POSITION has LEVEL."
+  (let ((face (get-text-property position 'face))
+actual-level)
+(when (not (and face
+(let* ((face-string (symbol-name face))
+   (matches (string-match
+ context-coloring-level-face-regexp
+ face-string)))
+  (when matches
+(setq actual-level (string-to-number
+(substring face-string
+   (match-beginning 1)
+   (match-end 1
+(= level actual-level)
+  (ert-fail (format (concat "Expected level at position %s, "
+"which is \"%s\", to be %s; "
+"but it was %s")
+position
+(buffer-substring-no-properties position (1+ 
position)) level
+actual-level)
+
+(defun context-coloring-test-assert-position-face (position face-regexp)
+  "Assert that the face at POSITION satisfies FACE-REGEXP."
+  (let ((face (get-text-property position 'face)))
+(when (or
+   ;; Pass a non-string to do an `eq' check (against a symbol or nil).
+   (unless (stringp face-regexp)
+ (not (eq face-regexp face)))
+   ;; Otherwise do the matching.
+   (when (stringp face-regexp)
+ (not (string-match-p face-regexp (symbol-name face)
+  (ert-fail (format (concat "Expected face at position %s, "
+"which is \"%s\", to be %s; "
+"but it was %s")
+position
+(buffer-substring-no-properties position (1+ 
position)) face-regexp
+face)
+
+(defun context-coloring-test-assert-position-comment (position)
+  (context-coloring-test-assert-position-face
+   position "\\`font-lock-comment\\(-delimiter\\)?-face\\'"))
+
+(defun context-coloring-test-assert-position-string (position)
+  (context-coloring-test-assert-position-face position 'font-lock-string-face))
+
+(defun context-coloring-test-assert-coloring (map)
+  "Assert that the current buffer's coloring matches MAP."
+  ;; Omit the superfluous, formatting-related leading newline.
+  (save-excursion
+(goto-char (point-min))
+(let* ((map (substring map 1))
+   (index 0)
+   char-string
+   char)
+  (while (< index (length map))
+(setq char-string (substring map index (1+ index)))
+(setq char (string-to-char char-string))
+(cond
+ ;; Newline
+ ((= char 10)
+  (next-logical-line)
+  (beginning-of-line))
+ ;; Number
+ ((and (>= char 48)
+   (<= char 57))
+  (context-coloring-test-assert-position-level
+   (point) (string-to-number char-string))
+  (forward-char))
+ ;; ';' = Comment
+ ((= char 59)
+  (context-coloring-test-assert-position-comment (point))
+  (forward-char))
+ ;; 's' = String
+ ((= char 115)
+  (context-coloring-test-assert-position-string (point))
+  (forward-char))
+ (t
+  (forward-char)))
+(setq index (1+ index))
+
 (defmacro context-coloring-test-assert-region (&rest body)
   "Assert something about the face of points in a region.
 Provides the free variables `i', `length', `point', `face' and
@@ -1006,81 +1087,53 @@ see that function."
 
 (context-coloring-test-deftest-emacs-lisp-mode defun
   (lambda ()
-(context-coloring-test-assert-region-level 1 8 1); (defun
-(context-coloring-test-assert-region-level 8 11 0)   ; abc
-(context-coloring-test-assert-region-level 11 39 1)  ; (def ghi &optional 
jkl) (
-(context-coloring-test-assert-region-level 39 40 0)  ; +
-(context-coloring-test-assert-region-level 40 53 1)  ; def ghi jkl
-

[elpa] master 62506ae 06/47: Add quote and number coloring.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 62506ae9653eae070b1e329be2b7fc7a32572fbb
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add quote and number coloring.
---
 context-coloring.el   |   80 ++--
 test/context-coloring-test.el |   17 +
 test/fixtures/quote.el|4 ++
 3 files changed, 89 insertions(+), 12 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 5f443dd..d5da9da 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -327,6 +327,20 @@ generated by `js2-mode'."
 ;; Assume global
 (or level 0)))
 
+(defun context-coloring-make-backtick (end enabled)
+  (list
+   :end end
+   :enabled enabled))
+
+(defun context-coloring-backtick-get-end (backtick)
+  (plist-get backtick :end))
+
+(defun context-coloring-backtick-get-enabled (backtick)
+  (plist-get backtick :enabled))
+
+(defun context-coloring-backtick-enabled-p (backtick-stack)
+  (context-coloring-backtick-get-enabled (car backtick-stack)))
+
 (defun context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
   (or (= 2 syntax-code)
   (= 3 syntax-code)))
@@ -342,6 +356,7 @@ generated by `js2-mode'."
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
  (scope-stack `(,(context-coloring-make-scope -1 0))) ; -1 never 
matches a depth
+ (backtick-stack `(,(context-coloring-make-backtick -1 nil)))
  one-word-found-p
  in-defun-p
  in-lambda-p
@@ -355,6 +370,7 @@ generated by `js2-mode'."
  token-pos
  token-syntax
  token-syntax-code
+ token-char
  child-0-pos
  child-0-end
  child-0-syntax
@@ -365,7 +381,7 @@ generated by `js2-mode'."
  child-1-syntax
  child-1-syntax-code
  child-2-end)
-(while (> end (progn (skip-syntax-forward "^()w_" end)
+(while (> end (progn (skip-syntax-forward "^()w_'" end)
  (point)))
   (setq token-pos (point))
   (setq token-syntax (syntax-after token-pos))
@@ -374,7 +390,38 @@ generated by `js2-mode'."
   ;; `skip-syntax-forward' leaves the point at the delimiter, move past
   ;; it.
   (setq token-syntax-code (logand #x (car token-syntax)))
+  (setq token-char (string-to-char (buffer-substring-no-properties
+token-pos
+(1+ token-pos
   (cond
+
+   ;; Expression prefix
+   ;; Has to come first in case of commas
+   ((= 6 token-syntax-code)
+(forward-char)
+(cond
+ ;; Just outright skip top-level symbols
+ ((not (or (cadr backtick-stack)
+   (= token-char 96))) ; 96 = '`'
+  (goto-char (scan-sexps (point) 1)))
+ ((or (= token-char 96)  ; 96 = '`'
+  (= token-char 44)) ; 44 = ','
+  ;; Have to manage backticks
+  (setq backtick-stack (cons (context-coloring-make-backtick
+  (scan-sexps (point) 1) ; End of the 
backtick
+  (= token-char 96)) ; 96 = '`'
+ backtick-stack)
+
+   ;; End backtick
+   ((and (cadr backtick-stack)
+ (>= (point) (context-coloring-backtick-get-end (car 
backtick-stack
+(setq backtick-stack (cdr backtick-stack)))
+
+   ;; Restricted by backtick
+   ((and (cadr backtick-stack)
+ (context-coloring-backtick-enabled-p backtick-stack))
+(forward-char))
+
;; Opening delimiter
((= 4 token-syntax-code)
 (forward-char)
@@ -455,30 +502,39 @@ generated by `js2-mode'."
(1+ token-pos))
 ;; Cleanup
 (setq one-word-found-p nil))
+
;; Word (variable)
((context-coloring-emacs-lisp-identifier-syntax-p token-syntax-code)
 (setq variable-end (scan-sexps (point) 1))
 (setq variable-string (buffer-substring-no-properties
token-pos
variable-end))
-(setq variable (intern variable-string))
-(setq variable-scope-level
-  (context-coloring-get-variable-level scope-stack variable))
-(when (/= variable-scope-level (context-coloring-scope-get-level
-(car scope-stack)))
-  (context-coloring-colorize-region
-   token-pos
-   variable-end
-   variable-scope-level))
+(

[elpa] master 5acd088 10/47: Add non-recursive let* coloring.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 5acd088cbb1a9115d77d71279eabc0e2d8e8ea93
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add non-recursive let* coloring.
---
 context-coloring.el   |   59 ---
 test/context-coloring-test.el |   78 -
 test/fixtures/let*.el |9 +
 3 files changed, 109 insertions(+), 37 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 3bd2b0f..3a57b3f 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -341,6 +341,13 @@ generated by `js2-mode'."
 (defun context-coloring-backtick-enabled-p (backtick-stack)
   (context-coloring-backtick-get-enabled (car backtick-stack)))
 
+(defun context-coloring-make-let-value (end)
+  (list
+   :end end))
+
+(defun context-coloring-let-value-get-end (let-value)
+  (plist-get let-value :end))
+
 (defun context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
   (or (= 2 syntax-code)
   (= 3 syntax-code)))
@@ -349,6 +356,9 @@ generated by `js2-mode'."
   "Move forward through whitespace and comments."
   (while (forward-comment 1)))
 
+(defun context-coloring-at-open-parenthesis ()
+  (= 4 (logand #x (car (syntax-after (point))
+
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
   (with-silent-modifications
@@ -361,12 +371,16 @@ generated by `js2-mode'."
  (ppss (syntax-ppss))
  (scope-stack `(,(context-coloring-make-scope -1 0))) ; -1 never 
matches a depth
  (backtick-stack `(,(context-coloring-make-backtick -1 nil)))
+ (let-value-stack `(,(context-coloring-make-let-value -1)))
  one-word-found-p
  in-defun-p
  in-lambda-p
+ in-let*-p
  function-call-p
  defun-arglist
  defun-arg
+ let-varlist
+ let-var
  variable
  variable-end
  variable-string
@@ -453,14 +467,18 @@ generated by `js2-mode'."
   (setq child-0-end (scan-sexps child-0-pos 1))
   (setq child-0-string (buffer-substring-no-properties child-0-pos 
child-0-end))
   (cond
-   ((string-match-p "defun\\|defmacro" child-0-string)
+   ((string-match-p "\\`defun\\'\\|\\`defmacro\\'" child-0-string)
 (setq in-defun-p t))
-   ((string-match-p "lambda" child-0-string)
+   ((string-match-p "\\`lambda\\'" child-0-string)
 (setq in-lambda-p t))
+   ((string-match-p "\\`let\\*\\'" child-0-string)
+(setq in-let*-p t))
;; Assume a global function call
(t
 (setq function-call-p t)
-(when (or in-defun-p in-lambda-p)
+(when (or in-defun-p
+  in-lambda-p
+  in-let*-p)
   (setq scope-stack (cons (context-coloring-make-scope
(nth 0 ppss)
(1+ (context-coloring-scope-get-level
@@ -475,7 +493,8 @@ generated by `js2-mode'."
   (context-coloring-colorize-region child-0-pos child-0-end 0)
   (setq function-call-p nil))
 (cond
- ((or in-defun-p in-lambda-p)
+ ((or in-defun-p
+  in-lambda-p)
   (goto-char child-0-end)
   (when in-defun-p
 ;; Lookahead for defun name
@@ -492,7 +511,8 @@ generated by `js2-mode'."
   (goto-char child-1-end
   ;; Lookahead for parameters
   (context-coloring-forward-sws)
-  (when (= 4 (logand #x (car (syntax-after (point)
+  (when (context-coloring-at-open-parenthesis)
+;; Actually it should be `child-1-end' for `lambda'.
 (setq child-2-end (scan-sexps (point) 1))
 (setq defun-arglist (read (buffer-substring-no-properties
(point)
@@ -509,6 +529,35 @@ generated by `js2-mode'."
   ;; Cleanup
   (setq in-defun-p nil)
   (setq in-lambda-p nil))
+ (in-let*-p
+  (goto-char child-0-end)
+  ;; Lookahead for bindings
+  (context-coloring-forward-sws)
+  (setq child-1-pos (point))
+  (setq child-1-syntax (syntax-after child-1-pos))
+  (setq child-1-syntax-code (logand #x (car child-1-syntax)))
+  (when (= 4 child-1-syntax-code)
+(setq child-1-end (scan-sexps (point) 1))
+(setq let-varlist (read (buffer-substring-no-properties
+ 

[elpa] master 08bf3e4 23/47: Ignore question marks.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 08bf3e4d6d1ef4d837e7c0ef5d2db4d661ce0715
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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

diff --git a/context-coloring.el b/context-coloring.el
index 6c56d14..2c5f44b 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -402,7 +402,7 @@ generated by `js2-mode'."
   "\\`[^&:]")
 
 (defconst context-coloring-ignored-word-regexp
-  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'\\|\\`\\.\\'")
+  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'\\|\\`\\.\\'\\|\\`\\?\\'")
 
 (defconst context-coloring-COMMA-CHAR 44)
 (defconst context-coloring-BACKTICK-CHAR 96)



[elpa] master 5c5b429 32/47: Fix font-lock error.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 5c5b429efdc9ffdef75bf987b4fb57f6089439c7
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix font-lock error.
---
 context-coloring.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 1e9553d..3a05bc2 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -193,6 +193,7 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
 (or max (point-max)))
 ;; TODO: Make configurable at the dispatch level.
 (when (eq major-mode 'emacs-lisp-mode)
+  (font-lock-set-defaults)
   (font-lock-fontify-keywords-region (or min (point-min))
  (or max (point-max
 



[elpa] master 88a921f 35/47: Improve defun regexp.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 88a921f641dccc268b3b35f07abbea1d1d8e30a6
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Improve defun regexp.
---
 context-coloring.el |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ae5ed90..ead1a79 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -389,14 +389,26 @@ generated by `js2-mode'."
 (defun context-coloring-stack-depth-equal (stack depth)
   (= (plist-get (car stack) :depth) depth))
 
+(defun context-coloring-exact-regexp (word)
+  "Create a regexp that matches exactly WORD."
+  (concat "\\`" (regexp-quote word) "\\'"))
+
+(defun context-coloring-exact-or-regexp (words)
+  "Create a regexp that matches any exact word in WORDS."
+  (context-coloring-join
+   (mapcar 'context-coloring-exact-regexp words) "\\|"))
+
 (defconst context-coloring-defun-regexp
-  "\\`defun\\'\\|\\`defmacro\\'\\|\\`defsubst\\'")
+  (context-coloring-exact-or-regexp
+   '("defun" "defun*" "defsubst" "defmacro"
+ "cl-defun" "cl-defsubst" "cl-defmacro")))
 
 (defconst context-coloring-arglist-arg-regexp
   "\\`[^&:]")
 
 (defconst context-coloring-ignored-word-regexp
-  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'\\|\\`\\.\\'\\|\\`\\?\\'")
+  (concat "\\`[-+]?[0-9]\\|" (context-coloring-exact-or-regexp
+  '("t" "nil" "." "?"
 
 (defconst context-coloring-COMMA-CHAR 44)
 (defconst context-coloring-BACKTICK-CHAR 96)



[elpa] master 29328af 18/47: Add let test.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 29328afbbf67a618a2e670671693ec2c48c8a717
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add let test.
---
 test/context-coloring-test.el |8 
 test/fixtures/let.el  |4 
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 1d154e2..f98d935 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1136,6 +1136,14 @@ see that function."
 (x x ()
   (x x 1 11 11 111 11 1 111))")))
 
+(context-coloring-test-deftest-emacs-lisp-mode let
+  (lambda ()
+(context-coloring-test-assert-coloring "
+ 11
+  11 01
+  11 11
+   1 1 1 11")))
+
 (context-coloring-test-deftest-emacs-lisp-mode let*
   (lambda ()
 (context-coloring-test-assert-coloring "
diff --git a/test/fixtures/let.el b/test/fixtures/let.el
new file mode 100644
index 000..3b869ce
--- /dev/null
+++ b/test/fixtures/let.el
@@ -0,0 +1,4 @@
+(let (a
+  (b a)
+  (c free))
+  (and a b c free))



[elpa] master c830ae5 15/47: Fix let* test.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit c830ae52b50bfd2c0c170a54b67ebc4139b2a7eb
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix let* test.
---
 test/context-coloring-test.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index c8a3532..64667a4 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1142,12 +1142,12 @@ see that function."
 1 11
11 11
11 11
-  1000 1 1 1 0 0 1
+   1 1 1 0 0 1
   2 22
  22 12
  22 22
-2000 1 1 2 2 2 ))
-  1000 1 1 1 0 0 11")))
+ 1 1 2 2 2 ))
+   1 1 1 0 0 11")))
 
 (provide 'context-coloring-test)
 



[elpa] master 6392d1f 40/47: Bind optional parameters earlier.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 6392d1f3e0764414f019e4c76baf25b66101f5f6
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Bind optional parameters earlier.
---
 context-coloring.el |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 057b4d8..c7a3f08 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -172,7 +172,9 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   (when (or context-coloring-comments-and-strings
 context-coloring-syntactic-comments
 context-coloring-syntactic-strings)
-(let ((font-lock-syntactic-face-function
+(let ((min (or min (point-min)))
+  (max (or max (point-max)))
+  (font-lock-syntactic-face-function
(cond
 ((and context-coloring-syntactic-comments
   (not context-coloring-syntactic-strings))
@@ -183,12 +185,10 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
 (t
  font-lock-syntactic-face-function
   (save-excursion
-(font-lock-fontify-syntactically-region (or min (point-min))
-(or max (point-max)))
+(font-lock-fontify-syntactically-region min max)
 ;; TODO: Make configurable at the dispatch level.
 (when (eq major-mode 'emacs-lisp-mode)
-  (font-lock-fontify-keywords-region (or min (point-min))
- (or max (point-max
+  (font-lock-fontify-keywords-region min max))
 
 
 ;;; js2-mode colorization



[elpa] master dc2f9a6 25/47: Refactor maybe-colorize-comments-and-strings.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit dc2f9a6e3b43e7559b9d2325031bdd79542e9cf1
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Refactor maybe-colorize-comments-and-strings.
---
 context-coloring.el |   30 +-
 1 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 940b90d..22097a5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -172,29 +172,25 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   "Tell `font-lock' to color a string but not a comment."
   (if (nth 3 state) font-lock-string-face nil))
 
-(defsubst context-coloring-maybe-colorize-comments-and-strings ()
+(defsubst context-coloring-maybe-colorize-comments-and-strings (&optional min 
max)
   "Color the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
   (when (or context-coloring-comments-and-strings
 context-coloring-syntactic-comments
 context-coloring-syntactic-strings)
-(let ((old-function font-lock-syntactic-face-function)
-  saved-function-p)
-  (cond
-   ((and context-coloring-syntactic-comments
- (not context-coloring-syntactic-strings))
-(setq font-lock-syntactic-face-function
-  'context-coloring-font-lock-syntactic-comment-function)
-(setq saved-function-p t))
-   ((and context-coloring-syntactic-strings
- (not context-coloring-syntactic-comments))
-(setq font-lock-syntactic-face-function
-  'context-coloring-font-lock-syntactic-string-function)
-(setq saved-function-p t)))
+(let ((font-lock-syntactic-face-function
+   (cond
+((and context-coloring-syntactic-comments
+  (not context-coloring-syntactic-strings))
+ 'context-coloring-font-lock-syntactic-comment-function)
+((and context-coloring-syntactic-strings
+  (not context-coloring-syntactic-comments))
+ 'context-coloring-font-lock-syntactic-string-function)
+(t
+ font-lock-syntactic-face-function
   (save-excursion
-(font-lock-fontify-syntactically-region (point-min) (point-max)))
-  (when saved-function-p
-(setq font-lock-syntactic-face-function old-function)
+(font-lock-fontify-syntactically-region (or min (point-min))
+(or max (point-max)))
 
 
 ;;; js2-mode colorization



[elpa] master 89f20e4 28/47: Improve interruptability of syntactic coloring.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 89f20e43358e92caa0a6232f9699aea89a362f1c
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Improve interruptability of syntactic coloring.
---
 context-coloring.el |   52 +++---
 1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index d1c2d52..f21b323 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -172,6 +172,8 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   "Tell `font-lock' to color a string but not a comment."
   (if (nth 3 state) font-lock-string-face nil))
 
+;; TODO: Add specialized emacs-lisp version based on
+;; `lisp-font-lock-syntactic-face-function'.
 (defsubst context-coloring-maybe-colorize-comments-and-strings (&optional min 
max)
   "Color the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
@@ -415,7 +417,7 @@ As of this writing, emacs lisp colorization seems to run at 
about
 60,000 iterations per second.  A default value of 1000 should
 provide visually \"instant\" updates at ~60 frames per second.")
 
-(defvar context-coloring-verbose-parse t
+(defvar context-coloring-verbose-parse nil
   "Log useful information pertaining to a parse.")
 
 (defun context-coloring-emacs-lisp-colorize ()
@@ -427,6 +429,8 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
   (let* ((start-time (float-time))
  (inhibit-point-motion-hooks t)
  (iteration-count 0)
+ (last-fontified-position (point))
+ end-of-current-defun
  (end (point-max))
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
@@ -466,11 +470,25 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
  child-2-end)
 (while (> end (progn (skip-syntax-forward "^()w_'" end)
  (point)))
-  (and context-coloring-parse-interruptable-p
-   (zerop (% (setq iteration-count (1+ iteration-count))
- context-coloring-emacs-lisp-iterations-per-pause))
-   (input-pending-p)
-   (throw 'interrupted t))
+  ;; Sparingly-executed tasks.
+  (setq iteration-count (1+ iteration-count))
+  (when (zerop (% iteration-count
+  context-coloring-emacs-lisp-iterations-per-pause))
+;; Fontify until the end of the current defun because doing it in
+;; chunks based soley on point could result in partial
+;; re-fontifications over the contents of scopes.
+(setq end-of-current-defun (save-excursion
+ (end-of-defun)
+ (point)))
+;; Fontify in chunks.
+(context-coloring-maybe-colorize-comments-and-strings
+ last-fontified-position
+ end-of-current-defun)
+(setq last-fontified-position end-of-current-defun)
+(when (and context-coloring-parse-interruptable-p
+   (input-pending-p))
+  (throw 'interrupted t)))
+
   (setq token-pos (point))
   (setq token-syntax (syntax-after token-pos))
   (setq token-syntax-code (logand #x (car token-syntax)))
@@ -701,10 +719,13 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
   (setq popped-vars (cdr popped-vars
 
))
+;; Fontify the last stretch.
+(context-coloring-maybe-colorize-comments-and-strings
+ last-fontified-position
+ (point))
 (when context-coloring-verbose-parse
   (message "Elapsed: %s; iterations: %s"
-   (- (float-time) start-time) iteration-count
-(context-coloring-maybe-colorize-comments-and-strings)))
+   (- (float-time) start-time) iteration-count))
 
 
 ;;; Shell command scopification / colorization
@@ -847,11 +868,7 @@ should be numeric, e.g. \"2\", \"19700101\", \"1.2.3\",
 `context-coloring-mode' is enabled.
 
 `:teardown' - Arbitrary code to tear down this dispatch when
-`context-coloring-mode' is disabled.
-
-`:interrupt' - Arbitrary code to run if parsing or coloring is
-interrupted (for synchronous strategies like `:colorizer' and
-`:scopifier')."
+`context-coloring-mode' is disabled."
   (let ((modes (plist-get properties :modes))
 (colorizer (plist-get properties :colorizer))
 (scopifier (plist-get properties :scopifier))
@@ -1346,10 +1363,6 @@ Supported modes: `js-mode', `js3-mode'"
  'emacs-lisp
  :modes '(emacs-lisp-mode)
  :colorizer 'context-coloring-em

[elpa] master b4072c1 14/47: Trivial refactoring for clarity.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit b4072c1481873e4274cd187a76ae9d4afffae52c
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Trivial refactoring for clarity.
---
 context-coloring.el |  149 +++---
 1 files changed, 80 insertions(+), 69 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 9c31314..9e1e1ed 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -324,7 +324,7 @@ generated by `js2-mode'."
 (setq level (context-coloring-scope-get-level scope)))
(t
 (setq scope-stack (cdr scope-stack)
-;; Assume global
+;; Assume a global variable.
 (or level 0)))
 
 (defun context-coloring-make-backtick (end enabled)
@@ -341,37 +341,58 @@ generated by `js2-mode'."
 (defun context-coloring-backtick-enabled-p (backtick-stack)
   (context-coloring-backtick-get-enabled (car backtick-stack)))
 
-(defun context-coloring-make-let-value (end)
-  (list
-   :end end))
+(defun context-coloring-forward-sws ()
+  "Move forward through whitespace and comments."
+  (while (forward-comment 1)))
 
-(defun context-coloring-let-value-get-end (let-value)
-  (plist-get let-value :end))
+(defun context-coloring-forward-sexp-position ()
+  (scan-sexps (point) 1))
 
 (defun context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
   (or (= 2 syntax-code)
   (= 3 syntax-code)))
 
-(defun context-coloring-forward-sws ()
-  "Move forward through whitespace and comments."
-  (while (forward-comment 1)))
+(defun context-coloring-open-parenthesis-p (syntax-code)
+  (= 4 syntax-code))
+
+(defun context-coloring-close-parenthesis-p (syntax-code)
+  (= 5 syntax-code))
 
-(defun context-coloring-at-open-parenthesis ()
+(defun context-coloring-expression-prefix-p (syntax-code)
+  (= 6 syntax-code))
+
+(defun context-coloring-at-open-parenthesis-p ()
   (= 4 (logand #x (car (syntax-after (point))
 
+(defun context-coloring-ppss-depth (ppss)
+  ;; Same as (nth 0 ppss).
+  (car ppss))
+
+(defconst context-coloring-defun-regexp
+  "\\`defun\\'\\|\\`defmacro\\'\\|\\`defsubst\\'")
+
+(defconst context-coloring-arglist-arg-regexp
+  "\\`[^&:]")
+
+(defconst context-coloring-unbindable-constant-regexp
+  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'")
+
+(defconst context-coloring-COMMA-CHAR 44)
+(defconst context-coloring-BACKTICK-CHAR 96)
+
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
   (with-silent-modifications
 (save-excursion
-  ;; TODO: Can probably make this lazy to the nearest defun
+  ;; TODO: Can probably make this lazy to the nearest defun.
   (goto-char (point-min))
   (let* ((inhibit-point-motion-hooks t)
  (end (point-max))
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
- (scope-stack `(,(context-coloring-make-scope -1 0))) ; -1 never 
matches a depth
- (backtick-stack `(,(context-coloring-make-backtick -1 nil)))
- (let-value-stack `(,(context-coloring-make-let-value -1)))
+ ; -1 never matches a depth.  This is a minor optimization.
+ (scope-stack `(,(context-coloring-make-scope -1 0)))
+ (backtick-stack '())
  one-word-found-p
  in-defun-p
  in-lambda-p
@@ -403,17 +424,13 @@ generated by `js2-mode'."
  (point)))
   (setq token-pos (point))
   (setq token-syntax (syntax-after token-pos))
+  (setq token-syntax-code (logand #x (car token-syntax)))
+  (setq token-char (char-after))
   (setq ppss (parse-partial-sexp last-ppss-pos token-pos nil nil ppss))
   (setq last-ppss-pos token-pos)
-  ;; `skip-syntax-forward' leaves the point at the delimiter, move past
-  ;; it.
-  (setq token-syntax-code (logand #x (car token-syntax)))
-  (setq token-char (string-to-char (buffer-substring-no-properties
-token-pos
-(1+ token-pos
   (cond
 
-   ;; Resolve invalid state
+   ;; Resolve an invalid state.
((cond
  ;; Inside string?
  ((nth 3 ppss)
@@ -422,54 +439,49 @@ generated by `js2-mode'."
   t)
  ;; Inside comment?
  ((nth 4 ppss)
-  (skip-syntax-forward "^>" end) ; comment ender
+  (skip-syntax-forward "^>" end)
   t)))
 
-   ;; Expression prefix
-   ;; Has to come first in case of commas
-   ((= 6 token-syntax-code)
+   ;; Need to check early in case there's a comma.
+   ((context-coloring-expression-prefix-p token-syntax-code)
 (forward-cha

[elpa] master ea3ff31 16/47: Pass let* test.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit ea3ff31c6c4183828b15d818a016d95bb8b58d24
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Pass let* test.
---
 context-coloring.el |  148 ++
 1 files changed, 112 insertions(+), 36 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 9e1e1ed..4a37389 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -341,6 +341,36 @@ generated by `js2-mode'."
 (defun context-coloring-backtick-enabled-p (backtick-stack)
   (context-coloring-backtick-get-enabled (car backtick-stack)))
 
+(defun context-coloring-make-let-varlist (depth type)
+  (list
+   :depth depth
+   :type type
+   :vars '()))
+
+(defun context-coloring-let-varlist-get-depth (let-varlist)
+  (plist-get let-varlist :depth))
+
+(defun context-coloring-let-varlist-get-type (let-varlist)
+  (plist-get let-varlist :type))
+
+(defun context-coloring-let-varlist-add-var (let-varlist var)
+  (plist-put let-varlist :vars (cons var (plist-get let-varlist :vars
+
+(defun context-coloring-let-varlist-pop-vars (let-varlist)
+  (let ((type (context-coloring-let-varlist-get-type let-varlist))
+(vars (plist-get let-varlist :vars)))
+(cond
+ ;; `let' binds all at once at the end.
+ ((eq type 'let)
+  (prog1
+  vars
+(plist-put let-varlist :vars '(
+ ;; `let*' binds incrementally.
+ ((eq type 'let*)
+  (prog1
+  (list (car vars))
+(plist-put let-varlist :vars (cdr vars)))
+
 (defun context-coloring-forward-sws ()
   "Move forward through whitespace and comments."
   (while (forward-comment 1)))
@@ -368,6 +398,9 @@ generated by `js2-mode'."
   ;; Same as (nth 0 ppss).
   (car ppss))
 
+(defun context-coloring-stack-depth-equal (stack depth)
+  (= (plist-get (car stack) :depth) depth))
+
 (defconst context-coloring-defun-regexp
   "\\`defun\\'\\|\\`defmacro\\'\\|\\`defsubst\\'")
 
@@ -390,9 +423,13 @@ generated by `js2-mode'."
  (end (point-max))
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
- ; -1 never matches a depth.  This is a minor optimization.
+ ppss-depth
+ ;; -1 never matches a depth.  This is a minor optimization.
  (scope-stack `(,(context-coloring-make-scope -1 0)))
  (backtick-stack '())
+ (let-varlist-stack '())
+ (let-var-stack '())
+ popped-vars
  one-word-found-p
  in-defun-p
  in-lambda-p
@@ -401,7 +438,7 @@ generated by `js2-mode'."
  defun-arglist
  defun-arg
  let-varlist
- let-var
+ let-varlist-type
  variable
  variable-end
  variable-string
@@ -481,14 +518,28 @@ generated by `js2-mode'."
   (setq child-0-end (scan-sexps child-0-pos 1))
   (setq child-0-string (buffer-substring-no-properties child-0-pos 
child-0-end))
   (cond
+   ;; Parse a var in a `let' varlist.
+   ((and
+ let-varlist-stack
+ (context-coloring-stack-depth-equal
+  let-varlist-stack
+  ;; 1- because we're inside the varlist.
+  (1- (context-coloring-ppss-depth ppss
+(context-coloring-let-varlist-add-var
+ (car let-varlist-stack)
+ (intern child-0-string))
+(setq let-var-stack (cons (context-coloring-ppss-depth ppss)
+  let-var-stack)))
((string-match-p context-coloring-defun-regexp child-0-string)
 (setq in-defun-p t))
((string-match-p "\\`lambda\\'" child-0-string)
 (setq in-lambda-p t))
((string-match-p "\\`let\\'" child-0-string)
-(setq in-let-p t))
+(setq in-let-p t)
+(setq let-varlist-type 'let))
((string-match-p "\\`let\\*\\'" child-0-string)
-(setq in-let*-p t)
+(setq in-let*-p t)
+(setq let-varlist-type 'let*)
 (when (or in-defun-p
   in-lambda-p
   in-let-p
@@ -544,31 +595,20 @@ generated by `js2-mode'."
  ((or in-let-p
   in-let*-p)
   (goto-char child-0-end)
-  ;; Look for bindings.
+  ;; Look for a varlist.
   (context-coloring-forward-sws)
   (setq child-1-pos (point))
   (setq child-1-syntax (syntax-after child-1-pos))
   (setq child-1-syntax-code (logand #x (car child-1-s

[elpa] master 59a6c8e 34/47: Fix timer disposal and timer buffer detection.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 59a6c8eac76fe32a2ae07e3b9c76668b3a81e907
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix timer disposal and timer buffer detection.
---
 context-coloring.el   |   22 +-
 test/context-coloring-test.el |2 +-
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index bf1d533..ae5ed90 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -47,12 +47,6 @@
 (require 'js2-mode)
 
 
-;;; Local variables
-
-(defvar-local context-coloring-buffer nil
-  "Reference to this buffer (for timers).")
-
-
 ;;; Utilities
 
 (defun context-coloring-join (strings delimiter)
@@ -811,7 +805,7 @@ read the scopifier's response asynchronously and apply a 
parsed
 list of tokens to `context-coloring-apply-tokens'.
 
 Invoke CALLBACK when complete."
-  (let ((buffer context-coloring-buffer))
+  (let ((buffer (current-buffer)))
 (context-coloring-scopify-shell-command
  command
  (lambda (output)
@@ -913,9 +907,9 @@ used.")
   (context-coloring-kill-scopifier)
   (setq context-coloring-changed t))
 
-(defun context-coloring-maybe-colorize ()
+(defun context-coloring-maybe-colorize (buffer)
   "Colorize the current buffer if it has changed."
-  (when (and (eq context-coloring-buffer (window-buffer (selected-window)))
+  (when (and (eq buffer (current-buffer))
  context-coloring-changed)
 (setq context-coloring-changed nil)
 (context-coloring-colorize)))
@@ -1334,11 +1328,14 @@ Supported modes: `js-mode', `js3-mode'"
   "Setup idle change detection."
   (add-hook
'after-change-functions 'context-coloring-change-function nil t)
+  (add-hook
+   'kill-buffer-hook 'context-coloring-teardown-idle-change-detection nil t)
   (setq context-coloring-colorize-idle-timer
 (run-with-idle-timer
  context-coloring-delay
  t
- 'context-coloring-maybe-colorize)))
+ 'context-coloring-maybe-colorize
+ (current-buffer
 
 (defun context-coloring-teardown-idle-change-detection ()
   "Teardown idle change detection."
@@ -1346,6 +1343,8 @@ Supported modes: `js-mode', `js3-mode'"
   (when context-coloring-colorize-idle-timer
 (cancel-timer context-coloring-colorize-idle-timer))
   (remove-hook
+   'kill-buffer-hook 'context-coloring-teardown-idle-change-detection t)
+  (remove-hook
'after-change-functions 'context-coloring-change-function t))
 
 
@@ -1424,9 +1423,6 @@ elisp tracks, and asynchronously for shell command 
tracks."
 (font-lock-mode)
 (jit-lock-mode t))
 
-;; Remember this buffer.  This value should not be dynamically-bound.
-(setq context-coloring-buffer (current-buffer))
-
 ;; Font lock is incompatible with this mode; the converse is also true.
 (font-lock-mode 0)
 (jit-lock-mode nil)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 9573119..5007c3c 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -474,7 +474,7 @@ FOREGROUND.  Apply ARGUMENTS to
(funcall done)))
 (insert " ")
 (set-window-buffer (selected-window) (current-buffer))
-(context-coloring-maybe-colorize)))
+(context-coloring-maybe-colorize (current-buffer
  (context-coloring-mode
 
 (ert-deftest context-coloring-test-check-version ()



[elpa] master b28e896 19/47: Add complex nesting to let test.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit b28e8969196beed4e1f8240cd5d5f49ea24d5000
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add complex nesting to let test.
---
 test/context-coloring-test.el |6 +-
 test/fixtures/let.el  |6 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index f98d935..234084c 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1141,7 +1141,11 @@ see that function."
 (context-coloring-test-assert-coloring "
  11
   11 01
-  11 11
+  11 1
+  11  22
+   22 02
+   22 22
+    2 2 2 2211
    1 1 1 11")))
 
 (context-coloring-test-deftest-emacs-lisp-mode let*
diff --git a/test/fixtures/let.el b/test/fixtures/let.el
index 3b869ce..11637b1 100644
--- a/test/fixtures/let.el
+++ b/test/fixtures/let.el
@@ -1,4 +1,8 @@
 (let (a
   (b a)
-  (c free))
+  (c free)
+  (d (let (a
+   (b a)
+   (c free))
+   (and a b c free
   (and a b c free))



[elpa] master 09ec36e 24/47: Add interruption mechanism.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 09ec36ebac10776a5982dd220ad9b6d8fd678579
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add interruption mechanism.
---
 context-coloring.el |   57 --
 1 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 2c5f44b..940b90d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -407,6 +407,15 @@ generated by `js2-mode'."
 (defconst context-coloring-COMMA-CHAR 44)
 (defconst context-coloring-BACKTICK-CHAR 96)
 
+(defvar context-coloring-parse-interruptable-p t
+  "Set this to nil to force parse to continue until finished.")
+
+(defvar context-coloring-tokens-per-pause 25
+  "Pause after this many statements to check for user input.
+If user input is pending, stop the parse.  This makes for a
+smoother user experience for large files.  This appears to be
+more or less how Eclipse, IntelliJ and other editors work.")
+
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
   (with-silent-modifications
@@ -414,6 +423,7 @@ generated by `js2-mode'."
   ;; TODO: Can probably make this lazy to the nearest defun.
   (goto-char (point-min))
   (let* ((inhibit-point-motion-hooks t)
+ (token-count 0)
  (end (point-max))
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
@@ -453,6 +463,11 @@ generated by `js2-mode'."
  child-2-end)
 (while (> end (progn (skip-syntax-forward "^()w_'" end)
  (point)))
+  (and context-coloring-parse-interruptable-p
+   (zerop (% (setq token-count (1+ token-count))
+ context-coloring-tokens-per-pause))
+   (input-pending-p)
+   (throw 'interrupted t))
   (setq token-pos (point))
   (setq token-syntax (syntax-after token-pos))
   (setq token-syntax-code (logand #x (car token-syntax)))
@@ -826,7 +841,11 @@ should be numeric, e.g. \"2\", \"19700101\", \"1.2.3\",
 `context-coloring-mode' is enabled.
 
 `:teardown' - Arbitrary code to tear down this dispatch when
-`context-coloring-mode' is disabled."
+`context-coloring-mode' is disabled.
+
+`:interrupt' - Arbitrary code to run if parsing or coloring is
+interrupted (for synchronous strategies like `:colorizer' and
+`:scopifier')."
   (let ((modes (plist-get properties :modes))
 (colorizer (plist-get properties :colorizer))
 (scopifier (plist-get properties :scopifier))
@@ -1322,6 +1341,10 @@ Supported modes: `js-mode', `js3-mode'"
  'emacs-lisp
  :modes '(emacs-lisp-mode)
  :colorizer 'context-coloring-emacs-lisp-colorize
+ ;; Comments and strings aren't colored till the end so it can be pretty ugly 
if
+ ;; you interrupt too far down the buffer.  TODO: Still not very satisfying,
+ ;; seeing flashes of uncolored code occassionally.
+ :interrupt 'context-coloring-maybe-colorize-comments-and-strings
  :setup
  (lambda ()
(context-coloring-setup-idle-change-detection))
@@ -1338,18 +1361,28 @@ the current buffer, then execute it.
 
 Invoke 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))
-colorizer
-scopifier
-command)
+  (let* ((dispatch (gethash major-mode context-coloring-mode-hash-table))
+ (colorizer (plist-get dispatch :colorizer))
+ (scopifier (plist-get dispatch :scopifier))
+ (command (plist-get dispatch :command))
+ (interrupt (plist-get dispatch :interrupt))
+ interrupted-p)
 (cond
- ((setq colorizer (plist-get dispatch :colorizer))
-  (funcall colorizer)
-  (when callback (funcall callback)))
- ((setq scopifier (plist-get dispatch :scopifier))
-  (context-coloring-apply-tokens (funcall scopifier))
-  (when callback (funcall callback)))
- ((setq command (plist-get dispatch :command))
+ ((or colorizer scopifier)
+  (setq interrupted-p
+(catch 'interrupted
+  (cond
+   (colorizer
+(funcall colorizer))
+   (scopifier
+(context-coloring-apply-tokens (funcall scopifier))
+  (cond
+   (interrupted-p
+(when interrupt (funcall interrupt))
+(setq context-coloring-changed t))
+   (t
+(when callback (funcall callback)
+ (command
   (context-coloring-scopify-and-colorize command callback)
 
 



[elpa] master 926d74a 17/47: Include binding order in let* test.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 926d74a0727f790e2c1d3fa64ad00d5d4174fcab
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Include binding order in let* test.
---
 test/context-coloring-test.el |6 --
 test/fixtures/let*.el |4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 64667a4..1d154e2 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1145,8 +1145,10 @@ see that function."
    1 1 1 0 0 1
   2 22
  22 12
- 22 22
- 1 1 2 2 2 ))
+ 22 2
+ 22 02
+ 22 222
+ 1 1 2 2 2 22
    1 1 1 0 0 11")))
 
 (provide 'context-coloring-test)
diff --git a/test/fixtures/let*.el b/test/fixtures/let*.el
index 967f866..44d743c 100644
--- a/test/fixtures/let*.el
+++ b/test/fixtures/let*.el
@@ -4,6 +4,8 @@
   (and a b c d e free)
   (let* (d
  (e a)
- (c free))
+ (c free)
+ (g f)
+ (f g))
 (and a b c d e free))
   (and a b c d e free))



[elpa] master 4ff6e82 39/47: Remove verbose parsing.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 4ff6e82bf9462168fae71d41c520ddec48c3b109
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Remove verbose parsing.
---
 context-coloring.el |   11 ++-
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index b8407a5..057b4d8 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -425,17 +425,13 @@ As of this writing, emacs lisp colorization seems to run 
at about
 60,000 iterations per second.  A default value of 1000 should
 provide visually \"instant\" updates at ~60 frames per second.")
 
-(defvar context-coloring-verbose-parse nil
-  "Log useful information pertaining to a parse.")
-
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
   (with-silent-modifications
 (save-excursion
   ;; TODO: Can probably make this lazy to the nearest defun.
   (goto-char (point-min))
-  (let* ((start-time (float-time))
- (inhibit-point-motion-hooks t)
+  (let* ((inhibit-point-motion-hooks t)
  (iteration-count 0)
  (last-fontified-position (point))
  beginning-of-current-defun
@@ -740,10 +736,7 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
 ;; Fontify the last stretch.
 (context-coloring-maybe-colorize-comments-and-strings
  last-fontified-position
- (point))
-(when context-coloring-verbose-parse
-  (message "Elapsed: %s; iterations: %s"
-   (- (float-time) start-time) iteration-count))
+ (point))
 
 
 ;;; Shell command scopification / colorization



[elpa] master 07c5852 30/47: Add idle change teardown function.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 07c5852f857cba4c59a491a8d4d0f920a3d8f05a
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add idle change teardown function.
---
 context-coloring.el |   25 +++--
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index d491f88..ae6abea 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -1340,6 +1340,14 @@ Supported modes: `js-mode', `js3-mode'"
  t
  'context-coloring-maybe-colorize)))
 
+(defun context-coloring-teardown-idle-change-detection ()
+  "Teardown idle change detection."
+  (context-coloring-kill-scopifier)
+  (when context-coloring-colorize-idle-timer
+(cancel-timer context-coloring-colorize-idle-timer))
+  (remove-hook
+   'after-change-functions 'context-coloring-change-function t))
+
 
 ;;; Built-in dispatches
 
@@ -1365,15 +1373,8 @@ Supported modes: `js-mode', `js3-mode'"
  'emacs-lisp
  :modes '(emacs-lisp-mode)
  :colorizer 'context-coloring-emacs-lisp-colorize
- :setup
- (lambda ()
-   (context-coloring-setup-idle-change-detection))
- :teardown
- (lambda ()
-   (when context-coloring-colorize-idle-timer
- (cancel-timer context-coloring-colorize-idle-timer))
-   (remove-hook
-'after-change-functions 'context-coloring-change-function t)))
+ :setup 'context-coloring-setup-idle-change-detection
+ :teardown 'context-coloring-teardown-idle-change-detection)
 
 (defun context-coloring-dispatch (&optional callback)
   "Determine the optimal track for scopification / coloring of
@@ -1412,16 +1413,12 @@ elisp tracks, and asynchronously for shell command 
tracks."
   nil " Context" nil
   (if (not context-coloring-mode)
   (progn
-(context-coloring-kill-scopifier)
-(when context-coloring-colorize-idle-timer
-  (cancel-timer context-coloring-colorize-idle-timer))
 (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))
+(context-coloring-teardown-idle-change-detection))
   (when teardown
 (funcall teardown)
 (font-lock-mode)



[elpa] master 708276e 41/47: Compiler micro-optimizations.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 708276e60cf4fc3a6e76f2568df8093991d865ce
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Compiler micro-optimizations.
---
 context-coloring.el |   50 +-
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index c7a3f08..46561f8 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -290,22 +290,22 @@ generated by `js2-mode'."
 
 ;;; Emacs Lisp colorization
 
-(defun context-coloring-make-scope (depth level)
+(defsubst context-coloring-make-scope (depth level)
   (list
:depth depth
:level level
:variables (make-hash-table)))
 
-(defun context-coloring-scope-get-level (scope)
+(defsubst context-coloring-scope-get-level (scope)
   (plist-get scope :level))
 
-(defun context-coloring-scope-add-variable (scope variable)
+(defsubst context-coloring-scope-add-variable (scope variable)
   (puthash variable t (plist-get scope :variables)))
 
-(defun context-coloring-scope-get-variable (scope variable)
+(defsubst context-coloring-scope-get-variable (scope variable)
   (gethash variable (plist-get scope :variables)))
 
-(defun context-coloring-get-variable-level (scope-stack variable)
+(defsubst context-coloring-get-variable-level (scope-stack variable)
   (let* (scope
  level)
 (while (and scope-stack (not level))
@@ -318,33 +318,33 @@ generated by `js2-mode'."
 ;; Assume a global variable.
 (or level 0)))
 
-(defun context-coloring-make-backtick (end enabled)
+(defsubst context-coloring-make-backtick (end enabled)
   (list
:end end
:enabled enabled))
 
-(defun context-coloring-backtick-get-end (backtick)
+(defsubst context-coloring-backtick-get-end (backtick)
   (plist-get backtick :end))
 
-(defun context-coloring-backtick-get-enabled (backtick)
+(defsubst context-coloring-backtick-get-enabled (backtick)
   (plist-get backtick :enabled))
 
-(defun context-coloring-backtick-enabled-p (backtick-stack)
+(defsubst context-coloring-backtick-enabled-p (backtick-stack)
   (context-coloring-backtick-get-enabled (car backtick-stack)))
 
-(defun context-coloring-make-let-varlist (depth type)
+(defsubst context-coloring-make-let-varlist (depth type)
   (list
:depth depth
:type type
:vars '()))
 
-(defun context-coloring-let-varlist-get-type (let-varlist)
+(defsubst context-coloring-let-varlist-get-type (let-varlist)
   (plist-get let-varlist :type))
 
-(defun context-coloring-let-varlist-add-var (let-varlist var)
+(defsubst context-coloring-let-varlist-add-var (let-varlist var)
   (plist-put let-varlist :vars (cons var (plist-get let-varlist :vars
 
-(defun context-coloring-let-varlist-pop-vars (let-varlist)
+(defsubst context-coloring-let-varlist-pop-vars (let-varlist)
   (let ((type (context-coloring-let-varlist-get-type let-varlist))
 (vars (plist-get let-varlist :vars)))
 (cond
@@ -359,41 +359,41 @@ generated by `js2-mode'."
   (list (car vars))
 (plist-put let-varlist :vars (cdr vars)))
 
-(defun context-coloring-forward-sws ()
+(defsubst context-coloring-forward-sws ()
   "Move forward through whitespace and comments."
   (while (forward-comment 1)))
 
-(defun context-coloring-forward-sexp-position ()
+(defsubst context-coloring-forward-sexp-position ()
   (scan-sexps (point) 1))
 
-(defun context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
+(defsubst context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
   (or (= 2 syntax-code)
   (= 3 syntax-code)))
 
-(defun context-coloring-open-parenthesis-p (syntax-code)
+(defsubst context-coloring-open-parenthesis-p (syntax-code)
   (= 4 syntax-code))
 
-(defun context-coloring-close-parenthesis-p (syntax-code)
+(defsubst context-coloring-close-parenthesis-p (syntax-code)
   (= 5 syntax-code))
 
-(defun context-coloring-expression-prefix-p (syntax-code)
+(defsubst context-coloring-expression-prefix-p (syntax-code)
   (= 6 syntax-code))
 
-(defun context-coloring-at-open-parenthesis-p ()
+(defsubst context-coloring-at-open-parenthesis-p ()
   (= 4 (logand #x (car (syntax-after (point))
 
-(defun context-coloring-ppss-depth (ppss)
+(defsubst context-coloring-ppss-depth (ppss)
   ;; Same as (nth 0 ppss).
   (car ppss))
 
-(defun context-coloring-stack-depth-equal (stack depth)
+(defsubst context-coloring-stack-depth-equal (stack depth)
   (= (plist-get (car stack) :depth) depth))
 
-(defun context-coloring-exact-regexp (word)
+(defsubst context-coloring-exact-regexp (word)
   "Create a regexp that matches exactly WORD."
   (concat "\\`" (regexp-quote word) "\\'"))
 
-(defun context-coloring-exact-or-regexp (words)
+(defsubst context-coloring-exact-or-regexp (words)
   "Create a regexp that matches any exact word in WORDS."
   (context-coloring-join
(mapcar 'context-coloring-exact-regexp words) "\\|"))
@@ -41

[elpa] master 3bf805d 46/47: Version 6.3.0.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 3bf805df83fe6f110f3e7e8ce2dc37e0cf6c14cb
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Version 6.3.0.
---
 context-coloring.el |   12 +---
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 5c3b76f..cb74ee7 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
 
 ;; Author: Jackson Ray Hamilton 
-;; Version: 6.2.1
+;; Version: 6.3.0
 ;; Keywords: convenience faces tools
 ;; Package-Requires: ((emacs "24") (js2-mode "20150126"))
 ;; URL: https://github.com/jacksonrayhamilton/context-coloring
@@ -32,16 +32,6 @@
 
 ;; By default, comments and strings are still highlighted syntactically.
 
-;; To use with js2-mode, add the following to your init file:
-
-;; (require 'context-coloring)
-;; (add-hook 'js2-mode-hook 'context-coloring-mode)
-
-;; To use with js-mode or js3-mode, install Node.js 0.10+ and the scopifier
-;; executable:
-
-;; $ npm install -g scopifier
-
 ;;; Code:
 
 (require 'js2-mode)



[elpa] master 3b6a391 44/47: Minor cleanup.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 3b6a3918ca329b1d836e492bd0b8403a1e696e65
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Minor cleanup.
---
 context-coloring.el |   37 -
 1 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 0249a5d..5c3b76f 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -364,6 +364,7 @@ generated by `js2-mode'."
   (while (forward-comment 1)))
 
 (defsubst context-coloring-forward-sexp-position ()
+  "Like vanilla `forward-sexp', but just return the position."
   (scan-sexps (point) 1))
 
 (defsubst context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
@@ -386,7 +387,7 @@ generated by `js2-mode'."
   ;; Same as (nth 0 ppss).
   (car ppss))
 
-(defsubst context-coloring-stack-depth-equal (stack depth)
+(defsubst context-coloring-at-stack-depth-p (stack depth)
   (= (plist-get (car stack) :depth) depth))
 
 (defsubst context-coloring-exact-regexp (word)
@@ -398,11 +399,20 @@ generated by `js2-mode'."
   (context-coloring-join
(mapcar 'context-coloring-exact-regexp words) "\\|"))
 
-(defconst context-coloring-defun-regexp
+(defconst context-coloring-emacs-lisp-defun-regexp
   (context-coloring-exact-or-regexp
'("defun" "defun*" "defsubst" "defmacro"
  "cl-defun" "cl-defsubst" "cl-defmacro")))
 
+(defconst context-coloring-emacs-lisp-lambda-regexp
+  (context-coloring-exact-regexp "lambda"))
+
+(defconst context-coloring-emacs-lisp-let-regexp
+  (context-coloring-exact-regexp "let"))
+
+(defconst context-coloring-emacs-lisp-let*-regexp
+  (context-coloring-exact-regexp "let*"))
+
 (defconst context-coloring-arglist-arg-regexp
   "\\`[^&:]")
 
@@ -423,7 +433,7 @@ smoother user experience for large files.
 
 As of this writing, emacs lisp colorization seems to run at about
 60,000 iterations per second.  A default value of 1000 should
-provide visually \"instant\" updates at ~60 frames per second.")
+provide visually \"instant\" updates at 60 frames per second.")
 
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
@@ -432,11 +442,11 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
   ;; TODO: Can probably make this lazy to the nearest defun.
   (goto-char (point-min))
   (let* ((inhibit-point-motion-hooks t)
+ (end (point-max))
  (iteration-count 0)
  (last-fontified-position (point))
  beginning-of-current-defun
  end-of-current-defun
- (end (point-max))
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
  ppss-depth
@@ -565,7 +575,7 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
;; Parse a var in a `let' varlist.
((and
  let-varlist-stack
- (context-coloring-stack-depth-equal
+ (context-coloring-at-stack-depth-p
   let-varlist-stack
   ;; 1- because we're inside the varlist.
   (1- (context-coloring-ppss-depth ppss
@@ -574,14 +584,14 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
  (intern child-0-string))
 (setq let-var-stack (cons (context-coloring-ppss-depth ppss)
   let-var-stack)))
-   ((string-match-p context-coloring-defun-regexp child-0-string)
+   ((string-match-p context-coloring-emacs-lisp-defun-regexp 
child-0-string)
 (setq in-defun-p t))
-   ((string-match-p "\\`lambda\\'" child-0-string)
+   ((string-match-p context-coloring-emacs-lisp-lambda-regexp 
child-0-string)
 (setq in-lambda-p t))
-   ((string-match-p "\\`let\\'" child-0-string)
+   ((string-match-p context-coloring-emacs-lisp-let-regexp 
child-0-string)
 (setq in-let-p t)
 (setq let-varlist-type 'let))
-   ((string-match-p "\\`let\\*\\'" child-0-string)
+   ((string-match-p context-coloring-emacs-lisp-let*-regexp 
child-0-string)
 (setq in-let*-p t)
 (setq let-varlist-type 'let*)
 (when (or in-defun-p
@@ -593,7 +603,8 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
(1+ (context-coloring-scope-get-level
 (car scope-stack
   scope-stack)))
-;; TODO: Proba

[elpa] master 6a4ad31 43/47: Add derived mode support.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 6a4ad31d4f86e6d1b129c17fb16deca9be148514
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add derived mode support.
---
 context-coloring.el   |   18 +++
 test/context-coloring-test.el |   49 +++--
 2 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 23af23d..0249a5d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -841,6 +841,15 @@ Invoke CALLBACK when complete."
 (defvar context-coloring-mode-hash-table (make-hash-table :test 'eq)
   "Map major mode names to dispatch property lists.")
 
+(defun context-coloring-get-dispatch-for-mode (mode)
+  "Return the dispatch for MODE (or a derivative mode)."
+  (let ((parent mode)
+dispatch)
+(while (and parent
+(not (setq dispatch (gethash parent 
context-coloring-mode-hash-table)))
+(setq parent (get parent 'derived-mode-parent
+dispatch))
+
 (defun context-coloring-define-dispatch (symbol &rest properties)
   "Define a new dispatch named SYMBOL with PROPERTIES.
 
@@ -969,7 +978,7 @@ produces (1 0 0), \"19700101\" produces (19700101), etc."
   "Asynchronously invoke CALLBACK with a predicate indicating
 whether the current scopifier version satisfies the minimum
 version number required for the current major mode."
-  (let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
+  (let ((dispatch (context-coloring-get-dispatch-for-mode major-mode)))
 (when dispatch
   (let ((version (plist-get dispatch :version))
 (command (plist-get dispatch :command)))
@@ -1396,7 +1405,7 @@ the current buffer, then execute it.
 
 Invoke 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))
+  (let* ((dispatch (context-coloring-get-dispatch-for-mode major-mode))
  (colorizer (plist-get dispatch :colorizer))
  (scopifier (plist-get dispatch :scopifier))
  (command (plist-get dispatch :command))
@@ -1427,7 +1436,7 @@ elisp tracks, and asynchronously for shell command 
tracks."
   nil " Context" nil
   (if (not context-coloring-mode)
   (progn
-(let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
+(let ((dispatch (context-coloring-get-dispatch-for-mode major-mode)))
   (when dispatch
 (let ((command (plist-get dispatch :command))
   (teardown (plist-get dispatch :teardown)))
@@ -1448,8 +1457,7 @@ elisp tracks, and asynchronously for shell command 
tracks."
 ;; Safely change the valye of this function as necessary.
 (make-local-variable 'font-lock-syntactic-face-function)
 
-;; TODO: Detect derived modes.
-(let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
+(let ((dispatch (context-coloring-get-dispatch-for-mode major-mode)))
   (if dispatch
   (progn
 (let ((command (plist-get dispatch :command))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 19f844b..e22ee29 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -348,8 +348,16 @@ EXPECTED-FACE."
   (context-coloring-test-assert-region-face
start end 'font-lock-string-face))
 
+(defun context-coloring-test-get-last-message ()
+  (let ((messages (split-string
+   (buffer-substring-no-properties
+(point-min)
+(point-max))
+   "\n")))
+(car (nthcdr (- (length messages) 2) messages
+
 (defun context-coloring-test-assert-message (expected buffer)
-  "Assert that message EXPECTED exists in BUFFER."
+  "Assert that message EXPECTED is at the end of BUFFER."
   (when (null (get-buffer buffer))
 (ert-fail
  (format
@@ -358,20 +366,28 @@ EXPECTED-FACE."
"but the buffer did not have any messages.")
   buffer expected)))
   (with-current-buffer buffer
-(let ((messages (split-string
- (buffer-substring-no-properties
-  (point-min)
-  (point-max))
- "\n")))
-  (let ((message (car (nthcdr (- (length messages) 2) messages
-(when (not (equal message expected))
+(let ((message (context-coloring-test-get-last-message)))
+  (when (not (equal message expected))
+(ert-fail
+ (format
+  (concat
+   "Expected buffer `%s' to have message \"%s\", "
+   "but instead it was \"%s\"")
+  buffer expected
+  message))
+
+(defun context-coloring-test-assert-not-message (expected buffer)
+ 

[elpa] master ef544ef 29/47: Fontify keywords.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit ef544ef9c523cf1586bb3f84da3eae91f6a87c03
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fontify keywords.
---
 context-coloring.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index f21b323..d491f88 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -172,8 +172,6 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   "Tell `font-lock' to color a string but not a comment."
   (if (nth 3 state) font-lock-string-face nil))
 
-;; TODO: Add specialized emacs-lisp version based on
-;; `lisp-font-lock-syntactic-face-function'.
 (defsubst context-coloring-maybe-colorize-comments-and-strings (&optional min 
max)
   "Color the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
@@ -192,7 +190,11 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
  font-lock-syntactic-face-function
   (save-excursion
 (font-lock-fontify-syntactically-region (or min (point-min))
-(or max (point-max)))
+(or max (point-max)))
+;; TODO: Make configurable at the dispatch level.
+(when (eq major-mode 'emacs-lisp-mode)
+  (font-lock-fontify-keywords-region (or min (point-min))
+ (or max (point-max
 
 
 ;;; js2-mode colorization



[elpa] master 1d7761c 37/47: Add constant comment test.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 1d7761cfe379df92226216ad0fa49aa7fb619cb3
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add constant comment test.
---
 test/context-coloring-test.el |   23 +--
 test/fixtures/depth.el|2 ++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 5007c3c..7466e23 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -212,9 +212,9 @@ environment."
   "Assert that the face at POSITION satisfies FACE-REGEXP."
   (let ((face (get-text-property position 'face)))
 (when (or
-   ;; Pass a non-string to do an `eq' check (against a symbol or nil).
+   ;; Pass a non-string to do an `equal' check (against a symbol or 
nil).
(unless (stringp face-regexp)
- (not (eq face-regexp face)))
+ (not (equal face-regexp face)))
;; Otherwise do the matching.
(when (stringp face-regexp)
  (not (string-match-p face-regexp (symbol-name face)
@@ -229,6 +229,10 @@ environment."
   (context-coloring-test-assert-position-face
position "\\`font-lock-comment\\(-delimiter\\)?-face\\'"))
 
+(defun context-coloring-test-assert-position-constant-comment (position)
+  (context-coloring-test-assert-position-face position 
'(font-lock-constant-face
+ 
font-lock-comment-face)))
+
 (defun context-coloring-test-assert-position-string (position)
   (context-coloring-test-assert-position-face position 'font-lock-string-face))
 
@@ -260,6 +264,10 @@ environment."
((= char 59)
 (context-coloring-test-assert-position-comment (point))
 (forward-char))
+   ;; 'c' = Constant comment
+   ((= char 99)
+(context-coloring-test-assert-position-constant-comment (point))
+(forward-char))
;; 's' = String
((= char 115)
 (context-coloring-test-assert-position-string (point))
@@ -1163,6 +1171,17 @@ see that function."
  1 1 2 2 2 22
    1 1 1 0 0 11")))
 
+(context-coloring-test-deftest-emacs-lisp-mode depth
+  (lambda ()
+(let ((context-coloring-emacs-lisp-iterations-per-pause 1))
+  (context-coloring-colorize)
+  (context-coloring-test-assert-coloring "
+;; `cc' `cc'
+(x x ())")))
+  :setup (lambda ()
+   (setq context-coloring-syntactic-comments t)
+   (setq context-coloring-syntactic-strings t)))
+
 (provide 'context-coloring-test)
 
 ;;; context-coloring-test.el ends here
diff --git a/test/fixtures/depth.el b/test/fixtures/depth.el
new file mode 100644
index 000..c4e99ac
--- /dev/null
+++ b/test/fixtures/depth.el
@@ -0,0 +1,2 @@
+;; `aa' `bb'
+(defun a ())



[elpa] master 5051a70 42/47: Update documentation for emacs lisp.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 5051a7021e22ff7584e76161b8e437075c593870
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Update documentation for emacs lisp.
---
 README.md   |   24 ++--
 context-coloring.el |2 +-
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index bc21b62..39c15cf 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,12 @@ By default, comments and strings are still highlighted 
syntactically.
 
 ## Features
 
-- Supported languages: JavaScript
 - Light and dark (customizable) color schemes.
-- Very fast for files under 1000 lines.
+- JavaScript support:
+  - Very fast for files under 1000 lines.
+  - Script, function and block scopes (and even `catch` block scopes).
+- Emacs Lisp support:
+  - `defun`, `lambda`, `let`, `let*`, quotes, backticks, commas.
 
 ## Installation
 
@@ -51,7 +54,7 @@ make compile
 (require 'context-coloring)
 ```
 
-### scopifier (for non-js2-mode users)
+### Dependencies (js-mode)
 
 ```bash
 npm install -g scopifier
@@ -62,12 +65,15 @@ npm install -g scopifier
 Add the following to your init file:
 
 ```lisp
-;; non-js2-mode users:
+;; js-mode:
 (add-hook 'js-mode-hook 'context-coloring-mode)
 
-;; js2-mode users:
+;; js2-mode:
 (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
 (add-hook 'js2-mode-hook 'context-coloring-mode)
+
+;; emacs-lisp-mode:
+(add-hook 'emacs-lisp-mode-hook 'context-coloring-mode)
 ```
 
 ## Customizing
@@ -79,7 +85,8 @@ Add the following to your init file:
 - `context-coloring-syntactic-strings` (default: `t`): If non-nil, also color
   strings using `font-lock`.
 - `context-coloring-delay` (default: `0.25`; supported modes: `js-mode`,
-  `js3-mode`): Delay between a buffer update and colorization.
+  `js3-mode`, `emacs-lisp-mode`): Delay between a buffer update and
+  colorization.
 - `context-coloring-js-block-scopes` (default: `nil`; supported modes:
   `js2-mode`): If non-nil, also color block scopes in the scope hierarchy in
   JavaScript.
@@ -170,6 +177,11 @@ When a `--version` argument is passed, a scopifier should 
print its version
 number and exit.  This allows context-coloring to determine if an update is
 required.
 
+Alternatively, you could implement a "colorizer" in Emacs Lisp.  A colorizer
+also handles the job of calling `context-coloring-colorize-region` to apply
+colors to a buffer.  A colorizer may have better performance than a scopifier
+when parsing and coloring can be performed in the same pass.
+
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier
diff --git a/context-coloring.el b/context-coloring.el
index 46561f8..23af23d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -1336,7 +1336,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
 Increase this if your machine is high-performing.  Decrease it if
 it ain't.
 
-Supported modes: `js-mode', `js3-mode'"
+Supported modes: `js-mode', `js3-mode', `emacs-lisp-mode'"
   :group 'context-coloring)
 
 (defun context-coloring-setup-idle-change-detection ()



[elpa] master 4bbce56 38/47: Add test for interruption.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 4bbce5681327381e34a745a364c45650c0b43e27
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add test for interruption.
---
 context-coloring.el  |   18 ++
 test/context-coloring-test.el|   26 --
 test/fixtures/{depth.el => iteration.el} |0
 3 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 585f325..b8407a5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -438,6 +438,7 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
  (inhibit-point-motion-hooks t)
  (iteration-count 0)
  (last-fontified-position (point))
+ beginning-of-current-defun
  end-of-current-defun
  (end (point-max))
  (last-ppss-pos (point))
@@ -485,13 +486,22 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
 ;; Fontify until the end of the current defun because doing it in
 ;; chunks based soley on point could result in partial
 ;; re-fontifications over the contents of scopes.
-(setq end-of-current-defun (save-excursion
- (end-of-defun)
- (point)))
+(save-excursion
+  (end-of-defun)
+  (setq end-of-current-defun (point))
+  (beginning-of-defun)
+  (setq beginning-of-current-defun (point)))
+
 ;; Fontify in chunks.
 (context-coloring-maybe-colorize-comments-and-strings
  last-fontified-position
- end-of-current-defun)
+ (cond
+  ;; We weren't actually in a defun, so don't color the next one, 
as
+  ;; that could result in `font-lock' properties being added to it.
+  ((> beginning-of-current-defun (point))
+   (point))
+  (t
+   end-of-current-defun)))
 (setq last-fontified-position (point))
 (when (and context-coloring-parse-interruptable-p
(input-pending-p))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 7466e23..19f844b 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -236,6 +236,9 @@ environment."
 (defun context-coloring-test-assert-position-string (position)
   (context-coloring-test-assert-position-face position 'font-lock-string-face))
 
+(defun context-coloring-test-assert-position-nil (position)
+  (context-coloring-test-assert-position-face position nil))
+
 (defun context-coloring-test-assert-coloring (map)
   "Assert that the current buffer's coloring matches MAP."
   ;; Omit the superfluous, formatting-related leading newline.  Can't use
@@ -268,6 +271,10 @@ environment."
((= char 99)
 (context-coloring-test-assert-position-constant-comment (point))
 (forward-char))
+   ;; 'n' = nil
+   ((= char 110)
+(context-coloring-test-assert-position-nil (point))
+(forward-char))
;; 's' = String
((= char 115)
 (context-coloring-test-assert-position-string (point))
@@ -1171,13 +1178,28 @@ see that function."
  1 1 2 2 2 22
    1 1 1 0 0 11")))
 
-(context-coloring-test-deftest-emacs-lisp-mode depth
+(defun context-coloring-test-insert-unread-space ()
+  (setq unread-command-events (cons '(t . 32)
+unread-command-events)))
+
+(defun context-coloring-test-remove-faces ()
+  (remove-text-properties (point-min) (point-max) '(face nil)))
+
+(context-coloring-test-deftest-emacs-lisp-mode iteration
   (lambda ()
 (let ((context-coloring-emacs-lisp-iterations-per-pause 1))
   (context-coloring-colorize)
   (context-coloring-test-assert-coloring "
 ;; `cc' `cc'
-(x x ())")))
+(x x ())")
+  (context-coloring-test-remove-faces)
+  (context-coloring-test-insert-unread-space)
+  (context-coloring-colorize)
+  ;; The first iteration will color the first part of the comment, but
+  ;; that's it.  Then it will be interrupted.
+  (context-coloring-test-assert-coloring "
+;;  
+nn n nnn")))
   :setup (lambda ()
(setq context-coloring-syntactic-comments t)
(setq context-coloring-syntactic-strings t)))
diff --git a/test/fixtures/depth.el b/test/fixtures/iteration.el
similarity index 100%
rename from test/fixtures/depth.el
rename to test/fixtures/iteration.el



[elpa] master d24de46 31/47: Add TODO.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit d24de46c7c737df8a1438c7e5ba000fd375dce9e
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

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

diff --git a/context-coloring.el b/context-coloring.el
index ae6abea..1e9553d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -1434,6 +1434,7 @@ elisp tracks, and asynchronously for shell command 
tracks."
 ;; Safely change the valye of this function as necessary.
 (make-local-variable 'font-lock-syntactic-face-function)
 
+;; TODO: Detect derived modes.
 (let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
   (if dispatch
   (progn



[elpa] master eb429df 02/47: Use lowercase for hex codes.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit eb429dfab8d9265dbdda91547f72e00818e39df2
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Use lowercase for hex codes.
---
 README.md   |   22 +++---
 context-coloring.el |   80 +-
 2 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/README.md b/README.md
index 6c895de..bc21b62 100644
--- a/README.md
+++ b/README.md
@@ -96,17 +96,17 @@ You can define your own theme colors too:
 ```lisp
 (context-coloring-define-theme
  'zenburn
- :colors '("#DCDCCC"
-   "#93E0E3"
-   "#BFEBBF"
-   "#F0DFAF"
-   "#DFAF8F"
-   "#CC9393"
-   "#DC8CC3"
-   "#94BFF3"
-   "#9FC59F"
-   "#D0BF8F"
-   "#DCA3A3"))
+ :colors '("#dcdccc"
+   "#93e0e3"
+   "#bfebbf"
+   "#f0dfaf"
+   "#dfaf8f"
+   "#cc9393"
+   "#dc8cc3"
+   "#94bff3"
+   "#9fc59f"
+   "#d0bf8f"
+   "#dca3a3"))
 ```
 
 See `C-h f context-coloring-define-theme` for more info on theme parameters.
diff --git a/context-coloring.el b/context-coloring.el
index d32a27d..c5c7d3f 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -793,7 +793,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
"#5180b3"
"#ab75c3"
"#cd7542"
-   "#dF9522"
+   "#df9522"
"#454545"))
 
 (context-coloring-define-theme
@@ -827,27 +827,27 @@ precedence, i.e. the car of `custom-enabled-themes'."
  'leuven
  :recede t
  :colors '("#33"
-   "#FF"
-   "#6434A3"
-   "#BA36A5"
-   "#D0372D"
-   "#036A07"
+   "#ff"
+   "#6434a3"
+   "#ba36a5"
+   "#d0372d"
+   "#036a07"
"#006699"
-   "#006FE0"
+   "#006fe0"
"#808080"))
 
 (context-coloring-define-theme
  'monokai
  :recede t
- :colors '("#F8F8F2"
-   "#66D9EF"
-   "#A1EFE4"
-   "#A6E22E"
-   "#E6DB74"
-   "#FD971F"
-   "#F92672"
-   "#FD5FF0"
-   "#AE81FF"))
+ :colors '("#f8f8f2"
+   "#66d9ef"
+   "#a1efe4"
+   "#a6e22e"
+   "#e6db74"
+   "#fd971f"
+   "#f92672"
+   "#fd5ff0"
+   "#ae81ff"))
 
 (context-coloring-define-theme
  'solarized
@@ -865,26 +865,26 @@ precedence, i.e. the car of `custom-enabled-themes'."
"#dc322f"
"#d33682"
"#6c71c4"
-   "#69B7F0"
-   "#69CABF"
-   "#B4C342"
-   "#DEB542"
-   "#F2804F"
-   "#FF6E64"
-   "#F771AC"
-   "#9EA0E5"))
+   "#69b7f0"
+   "#69cabf"
+   "#b4c342"
+   "#deb542"
+   "#f2804f"
+   "#ff6e64"
+   "#f771ac"
+   "#9ea0e5"))
 
 (context-coloring-define-theme
  'spacegray
  :recede t
  :colors '("#ff"
-   "#89AAEB"
-   "#C189EB"
+   "#89aaeb"
+   "#c189eb"
"#bf616a"
-   "#DCA432"
+   "#dca432"
"#ebcb8b"
-   "#B4EB89"
-   "#89EBCA"))
+   "#b4eb89"
+   "#89ebca"))
 
 (context-coloring-define-theme
  'tango
@@ -906,17 +906,17 @@ precedence, i.e. the car of `custom-enabled-themes'."
 (context-coloring-define-theme
  'zenburn
  :recede t
- :colors '("#DCDCCC"
-   "#93E0E3"
-   "#BFEBBF"
-   "#F0DFAF"
-   "#DFAF8F"
-   "#CC9393"
-   "#DC8CC3"
-   "#94BFF3"
-   "#9FC59F"
-   "#D0BF8F"
-   "#DCA3A3"))
+ :colors '("#dcdccc"
+   "#93e0e3"
+   "#bfebbf"
+   "#f0dfaf"
+   "#dfaf8f"
+   "#cc9393"
+   "#dc8cc3"
+   "#94bff3"
+   "#9fc59f"
+   "#d0bf8f"
+   "#dca3a3"))
 
 
 ;;; Minor mode



[elpa] master d7b2c92 21/47: Remove unused functions.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit d7b2c927664bf65962d7b8d893e56e1a2e38c623
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Remove unused functions.
---
 context-coloring.el |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 6f161c6..f217694 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -302,9 +302,6 @@ generated by `js2-mode'."
:level level
:variables (make-hash-table)))
 
-(defun context-coloring-scope-get-depth (scope)
-  (plist-get scope :depth))
-
 (defun context-coloring-scope-get-level (scope)
   (plist-get scope :level))
 
@@ -347,9 +344,6 @@ generated by `js2-mode'."
:type type
:vars '()))
 
-(defun context-coloring-let-varlist-get-depth (let-varlist)
-  (plist-get let-varlist :depth))
-
 (defun context-coloring-let-varlist-get-type (let-varlist)
   (plist-get let-varlist :type))
 



[elpa] master c0a6689 33/47: Only set defaults when the mode is enabled.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit c0a66895bf685ebbf36614b89ca2b187e3f4e351
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Only set defaults when the mode is enabled.
---
 context-coloring.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 3a05bc2..bf1d533 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -193,7 +193,6 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
 (or max (point-max)))
 ;; TODO: Make configurable at the dispatch level.
 (when (eq major-mode 'emacs-lisp-mode)
-  (font-lock-set-defaults)
   (font-lock-fontify-keywords-region (or min (point-min))
  (or max (point-max
 
@@ -1432,6 +1431,9 @@ elisp tracks, and asynchronously for shell command 
tracks."
 (font-lock-mode 0)
 (jit-lock-mode nil)
 
+;; ...but we do use font-lock functions here.
+(font-lock-set-defaults)
+
 ;; Safely change the valye of this function as necessary.
 (make-local-variable 'font-lock-syntactic-face-function)
 



[elpa] master 284cfa6 08/47: Don't treat unbindables like variables.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 284cfa6f6743c270c6dc8e9a383c29e450ad3ade
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Don't treat unbindables like variables.
---
 context-coloring.el   |6 --
 test/context-coloring-test.el |5 +
 test/fixtures/unbindable.el   |2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 92e4578..3bd2b0f 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -526,8 +526,10 @@ generated by `js2-mode'."
token-pos
variable-end))
 (cond
- ;; Ignore numbers
- ((string-match-p "\\`[-+]?[0-9]" variable-string))
+ ;; Ignore constants such as numbers, keywords, t, nil. These can't
+ ;; be rebound, so they should be treated like syntax.
+ ((string-match-p "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'" 
variable-string))
+ ((keywordp (read variable-string)))
  (t
   (setq variable (intern variable-string))
   (setq variable-scope-level
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 192d2ef..8e5b699 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1077,6 +1077,11 @@ see that function."
   :setup (lambda ()
(setq context-coloring-syntactic-strings t)))
 
+(context-coloring-test-deftest-emacs-lisp-mode unbindable
+  (lambda ()
+(context-coloring-test-assert-region-level 20 40 1)  ; 1 +1 -1 1.0 :a t nil
+))
+
 (provide 'context-coloring-test)
 
 ;;; context-coloring-test.el ends here
diff --git a/test/fixtures/unbindable.el b/test/fixtures/unbindable.el
new file mode 100644
index 000..d5bb47f
--- /dev/null
+++ b/test/fixtures/unbindable.el
@@ -0,0 +1,2 @@
+(defun a ()
+  (+ a 1 +1 -1 1.0 :a t nil))



[elpa] master a556195 26/47: Tweak iteration values, add logging.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit a5561959ebcdca49de518b7e8a40785bde5a52bf
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Tweak iteration values, add logging.
---
 context-coloring.el |   28 +++-
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 22097a5..a513947 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -406,11 +406,17 @@ generated by `js2-mode'."
 (defvar context-coloring-parse-interruptable-p t
   "Set this to nil to force parse to continue until finished.")
 
-(defvar context-coloring-tokens-per-pause 25
-  "Pause after this many statements to check for user input.
+(defvar context-coloring-emacs-lisp-iterations-per-pause 1000
+  "Pause after this many iterations to check for user input.
 If user input is pending, stop the parse.  This makes for a
-smoother user experience for large files.  This appears to be
-more or less how Eclipse, IntelliJ and other editors work.")
+smoother user experience for large files.
+
+As of this writing, emacs lisp colorization seems to run at about
+60,000 iterations per second.  A default value of 1000 should
+provide visually \"instant\" updates at ~60 frames per second.")
+
+(defvar context-coloring-verbose-parse t
+  "Log useful information pertaining to a parse.")
 
 (defun context-coloring-emacs-lisp-colorize ()
   "Color the current buffer by parsing emacs lisp sexps."
@@ -418,8 +424,9 @@ more or less how Eclipse, IntelliJ and other editors work.")
 (save-excursion
   ;; TODO: Can probably make this lazy to the nearest defun.
   (goto-char (point-min))
-  (let* ((inhibit-point-motion-hooks t)
- (token-count 0)
+  (let* ((start-time (float-time))
+ (inhibit-point-motion-hooks t)
+ (iteration-count 0)
  (end (point-max))
  (last-ppss-pos (point))
  (ppss (syntax-ppss))
@@ -460,8 +467,8 @@ more or less how Eclipse, IntelliJ and other editors work.")
 (while (> end (progn (skip-syntax-forward "^()w_'" end)
  (point)))
   (and context-coloring-parse-interruptable-p
-   (zerop (% (setq token-count (1+ token-count))
- context-coloring-tokens-per-pause))
+   (zerop (% (setq iteration-count (1+ iteration-count))
+ context-coloring-emacs-lisp-iterations-per-pause))
(input-pending-p)
(throw 'interrupted t))
   (setq token-pos (point))
@@ -693,7 +700,10 @@ more or less how Eclipse, IntelliJ and other editors 
work.")
   (context-coloring-scope-add-variable (car scope-stack) (car 
popped-vars))
   (setq popped-vars (cdr popped-vars
 
-   
+   ))
+(when context-coloring-verbose-parse
+  (message "Elapsed: %s; iterations: %s"
+   (- (float-time) start-time) iteration-count
 (context-coloring-maybe-colorize-comments-and-strings)))
 
 



[elpa] master 0836b9f 22/47: Add change hooks for elisp.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 0836b9f6ea7531d2d0be8fcd8a84418fc3fb09ad
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add change hooks for elisp.
---
 context-coloring.el |  103 +--
 1 files changed, 59 insertions(+), 44 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index f217694..6c56d14 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -842,49 +842,6 @@ should be numeric, e.g. \"2\", \"19700101\", \"1.2.3\",
   (when (null (gethash mode context-coloring-mode-hash-table))
 (puthash mode properties context-coloring-mode-hash-table)
 
-(context-coloring-define-dispatch
- 'javascript-node
- :modes '(js-mode js3-mode)
- :executable "scopifier"
- :command "scopifier"
- :version "v1.1.1")
-
-(context-coloring-define-dispatch
- 'javascript-js2
- :modes '(js2-mode)
- :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)))
-
-(context-coloring-define-dispatch
- 'emacs-lisp
- :modes '(emacs-lisp-mode)
- :colorizer 'context-coloring-emacs-lisp-colorize)
-
-(defun context-coloring-dispatch (&optional callback)
-  "Determine the optimal track for scopification / coloring of
-the current buffer, then execute it.
-
-Invoke 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))
-colorizer
-scopifier
-command)
-(cond
- ((setq colorizer (plist-get dispatch :colorizer))
-  (funcall colorizer)
-  (when callback (funcall callback)))
- ((setq scopifier (plist-get dispatch :scopifier))
-  (context-coloring-apply-tokens (funcall scopifier))
-  (when callback (funcall callback)))
- ((setq command (plist-get dispatch :command))
-  (context-coloring-scopify-and-colorize command callback)
-
 
 ;;; Colorization
 
@@ -1316,7 +1273,7 @@ precedence, i.e. the car of `custom-enabled-themes'."
"#dca3a3"))
 
 
-;;; Minor mode
+;;; Change detection
 
 (defvar-local context-coloring-colorize-idle-timer nil
   "The currently-running idle timer.")
@@ -1340,6 +1297,64 @@ Supported modes: `js-mode', `js3-mode'"
  t
  'context-coloring-maybe-colorize)))
 
+
+;;; Built-in dispatches
+
+(context-coloring-define-dispatch
+ 'javascript-node
+ :modes '(js-mode js3-mode)
+ :executable "scopifier"
+ :command "scopifier"
+ :version "v1.1.1")
+
+(context-coloring-define-dispatch
+ 'javascript-js2
+ :modes '(js2-mode)
+ :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)))
+
+(context-coloring-define-dispatch
+ 'emacs-lisp
+ :modes '(emacs-lisp-mode)
+ :colorizer 'context-coloring-emacs-lisp-colorize
+ :setup
+ (lambda ()
+   (context-coloring-setup-idle-change-detection))
+ :teardown
+ (lambda ()
+   (when context-coloring-colorize-idle-timer
+ (cancel-timer context-coloring-colorize-idle-timer))
+   (remove-hook
+'after-change-functions 'context-coloring-change-function t)))
+
+(defun context-coloring-dispatch (&optional callback)
+  "Determine the optimal track for scopification / coloring of
+the current buffer, then execute it.
+
+Invoke 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))
+colorizer
+scopifier
+command)
+(cond
+ ((setq colorizer (plist-get dispatch :colorizer))
+  (funcall colorizer)
+  (when callback (funcall callback)))
+ ((setq scopifier (plist-get dispatch :scopifier))
+  (context-coloring-apply-tokens (funcall scopifier))
+  (when callback (funcall callback)))
+ ((setq command (plist-get dispatch :command))
+  (context-coloring-scopify-and-colorize command callback)
+
+
+;;; Minor mode
+
 ;;;###autoload
 (define-minor-mode context-coloring-mode
   "Context-based code coloring, inspired by Douglas Crockford."



[elpa] master bd9c147 20/47: Ignore the dot.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit bd9c14741615469cc19aebaa659124117bf78169
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Ignore the dot.
---
 context-coloring.el   |6 +++---
 test/context-coloring-test.el |4 ++--
 test/fixtures/ignored.el  |2 ++
 test/fixtures/unbindable.el   |2 --
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 4a37389..6f161c6 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -407,8 +407,8 @@ generated by `js2-mode'."
 (defconst context-coloring-arglist-arg-regexp
   "\\`[^&:]")
 
-(defconst context-coloring-unbindable-constant-regexp
-  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'")
+(defconst context-coloring-ignored-word-regexp
+  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'\\|\\`\\.\\'")
 
 (defconst context-coloring-COMMA-CHAR 44)
 (defconst context-coloring-BACKTICK-CHAR 96)
@@ -630,7 +630,7 @@ generated by `js2-mode'."
 (cond
  ;; Ignore constants such as numbers, keywords, t, nil.  These 
can't
  ;; be rebound, so they should be treated like syntax.
- ((string-match-p context-coloring-unbindable-constant-regexp 
variable-string))
+ ((string-match-p context-coloring-ignored-word-regexp 
variable-string))
  ((keywordp (read variable-string)))
  (t
   (setq variable (intern variable-string))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 234084c..9573119 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1130,11 +1130,11 @@ see that function."
   :setup (lambda ()
(setq context-coloring-syntactic-strings t)))
 
-(context-coloring-test-deftest-emacs-lisp-mode unbindable
+(context-coloring-test-deftest-emacs-lisp-mode ignored
   (lambda ()
 (context-coloring-test-assert-coloring "
 (x x ()
-  (x x 1 11 11 111 11 1 111))")))
+  (x x 1 11 11 111 11 1 111 (1 1 1)))")))
 
 (context-coloring-test-deftest-emacs-lisp-mode let
   (lambda ()
diff --git a/test/fixtures/ignored.el b/test/fixtures/ignored.el
new file mode 100644
index 000..776a846
--- /dev/null
+++ b/test/fixtures/ignored.el
@@ -0,0 +1,2 @@
+(defun a ()
+  (+ a 1 +1 -1 1.0 :a t nil (0 . 0)))
diff --git a/test/fixtures/unbindable.el b/test/fixtures/unbindable.el
deleted file mode 100644
index d5bb47f..000
--- a/test/fixtures/unbindable.el
+++ /dev/null
@@ -1,2 +0,0 @@
-(defun a ()
-  (+ a 1 +1 -1 1.0 :a t nil))



[elpa] master d9d901f 03/47: Add basic elisp defun coloring.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit d9d901f2f60ec3f95fe6d6b5e6342cb5583918ac
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add basic elisp defun coloring.
---
 context-coloring.el   |  186 +
 test/context-coloring-test.el |   29 +++
 test/fixtures/defun.el|4 +
 3 files changed, 219 insertions(+), 0 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index c5c7d3f..7787cb5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -294,6 +294,187 @@ generated by `js2-mode'."
 (context-coloring-maybe-colorize-comments-and-strings)))
 
 
+;;; Emacs Lisp colorization
+
+(defun context-coloring-make-scope (depth level)
+  (list
+   :depth depth
+   :level level
+   :variables (make-hash-table)))
+
+(defun context-coloring-scope-get-depth (scope)
+  (plist-get scope :depth))
+
+(defun context-coloring-scope-get-level (scope)
+  (plist-get scope :level))
+
+(defun context-coloring-scope-add-variable (scope variable)
+  (puthash variable t (plist-get scope :variables)))
+
+(defun context-coloring-scope-get-variable (scope variable)
+  (gethash variable (plist-get scope :variables)))
+
+(defun context-coloring-get-variable-level (scope-stack variable)
+  (let* (scope
+ level)
+(while (and scope-stack (not level))
+  (setq scope (car scope-stack))
+  (cond
+   ((context-coloring-scope-get-variable scope variable)
+(setq level (context-coloring-scope-get-level scope)))
+   (t
+(setq scope-stack (cdr scope-stack)
+;; Assume global
+(or level 0)))
+
+(defun context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
+  (or (= 2 syntax-code)
+  (= 3 syntax-code)))
+
+(defun context-coloring-emacs-lisp-colorize ()
+  "Color the current buffer by parsing emacs lisp sexps."
+  (with-silent-modifications
+(save-excursion
+  ;; TODO: Can probably make this lazy to the nearest defun
+  (goto-char (point-min))
+  (let* ((inhibit-point-motion-hooks t)
+ (end (point-max))
+ (last-ppss-pos (point))
+ (ppss (syntax-ppss))
+ (scope-stack `(,(context-coloring-make-scope -1 0))) ; -1 never 
matches a depth
+ one-word-found-p
+ in-defun-p
+ function-call-p
+ defun-arglist
+ defun-arg
+ variable
+ variable-end
+ variable-string
+ variable-scope-level
+ token-pos
+ token-syntax
+ token-syntax-code
+ child-0-pos
+ child-0-end
+ child-0-syntax
+ child-0-syntax-code
+ child-0-string
+ child-1-pos
+ child-1-end
+ child-1-syntax
+ child-1-syntax-code
+ child-2-end)
+(while (> end (progn (skip-syntax-forward "^()w_" end)
+ (point)))
+  (setq token-pos (point))
+  (setq token-syntax (syntax-after token-pos))
+  (setq ppss (parse-partial-sexp last-ppss-pos token-pos nil nil ppss))
+  (setq last-ppss-pos token-pos)
+  ;; `skip-syntax-forward' leaves the point at the delimiter, move past
+  ;; it.
+  (setq token-syntax-code (logand #x (car token-syntax)))
+  (cond
+   ;; Opening delimiter
+   ((= 4 token-syntax-code)
+(forward-char)
+;; Lookahead for scopes / function calls
+(skip-syntax-forward " " end)
+(setq child-0-pos (point))
+(setq child-0-syntax (syntax-after child-0-pos))
+(setq child-0-syntax-code (logand #x (car child-0-syntax)))
+(cond
+ ;; Word
+ ((context-coloring-emacs-lisp-identifier-syntax-p 
child-0-syntax-code)
+  (setq one-word-found-p t)
+  (setq child-0-end (scan-sexps child-0-pos 1))
+  (setq child-0-string (buffer-substring-no-properties child-0-pos 
child-0-end))
+  (cond
+   ((string-match-p "defun\\|defmacro" child-0-string)
+(setq in-defun-p t)
+(setq scope-stack (cons (context-coloring-make-scope
+ (nth 0 ppss)
+ (1+ (context-coloring-scope-get-level
+  (car scope-stack
+scope-stack)))
+   ;; Assume a global function call
+   (t
+(setq function-call-p t)
+;; TODO: Probably redundant and wasteful
+(context-coloring-colorize-region token-pos
+  (scan-sexps token-pos 1)
+  (context-coloring-scope-get-level
+   

[elpa] master dd8d491 12/47: Also color defsubst.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit dd8d4916a2ebbd6f0b15912434280948eba5c70c
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Also color defsubst.
---
 context-coloring.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 0f65b57..a84a1b4 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -466,7 +466,9 @@ generated by `js2-mode'."
   (setq child-0-end (scan-sexps child-0-pos 1))
   (setq child-0-string (buffer-substring-no-properties child-0-pos 
child-0-end))
   (cond
-   ((string-match-p "\\`defun\\'\\|\\`defmacro\\'" child-0-string)
+   ((string-match-p
+ "\\`defun\\'\\|\\`defmacro\\'\\|\\`defsubst\\'"
+ child-0-string)
 (setq in-defun-p t))
((string-match-p "\\`lambda\\'" child-0-string)
 (setq in-lambda-p t))



[elpa] master 58b7474 11/47: Don't color function calls as level 0.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 58b7474f6d6e80a3b91c782c23453d173588f878
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Don't color function calls as level 0.
---
 context-coloring.el   |9 +
 test/context-coloring-test.el |   14 +++---
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 3a57b3f..0f65b57 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -376,7 +376,6 @@ generated by `js2-mode'."
  in-defun-p
  in-lambda-p
  in-let*-p
- function-call-p
  defun-arglist
  defun-arg
  let-varlist
@@ -472,10 +471,7 @@ generated by `js2-mode'."
((string-match-p "\\`lambda\\'" child-0-string)
 (setq in-lambda-p t))
((string-match-p "\\`let\\*\\'" child-0-string)
-(setq in-let*-p t))
-   ;; Assume a global function call
-   (t
-(setq function-call-p t)
+(setq in-let*-p t)
 (when (or in-defun-p
   in-lambda-p
   in-let*-p)
@@ -489,9 +485,6 @@ generated by `js2-mode'."
   (scan-sexps token-pos 1)
   (context-coloring-scope-get-level
(car scope-stack)))
-(when function-call-p
-  (context-coloring-colorize-region child-0-pos child-0-end 0)
-  (setq function-call-p nil))
 (cond
  ((or in-defun-p
   in-lambda-p)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 148ddac..c8a3532 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1090,7 +1090,7 @@ see that function."
   (lambda ()
 (context-coloring-test-assert-coloring "
 11 000  111 1 
-  10 111 111 111 11
+  11 111 111 111 11
 
  0 0 00
 
@@ -1101,16 +1101,16 @@ see that function."
   (lambda ()
 (context-coloring-test-assert-coloring "
  111 
-   1000 11 222 
- 200 22 12 2221 111 0 00")))
+    11 222 
+ 222 22 12 2221 111 0 00")))
 
 (context-coloring-test-deftest-emacs-lisp-mode quote
   (lambda ()
 (context-coloring-test-assert-coloring "
 (x x (x)
   (xx (xx x 111
-  10 1 111 111
-  10 1 00 11 111 1 110 1 1 1 11 1 1 1")))
+  11 1 111 111
+  11 1 11 11 111 1 111 1 1 1 11 1 1 1")))
 
 (context-coloring-test-deftest-emacs-lisp-mode comment
   (lambda ()
@@ -1118,7 +1118,7 @@ see that function."
 (context-coloring-test-assert-coloring "
 (x x ()
   (xx (x x- xx)   ;;
-  (0 x- xx))) ;;"))
+  11 0- 11))) ;;"))
   :setup (lambda ()
(setq context-coloring-syntactic-comments t)))
 
@@ -1134,7 +1134,7 @@ see that function."
   (lambda ()
 (context-coloring-test-assert-coloring "
 (x x ()
-  (0 0 1 11 11 111 11 1 111))")))
+  (x x 1 11 11 111 11 1 111))")))
 
 (context-coloring-test-deftest-emacs-lisp-mode let*
   (lambda ()



[elpa] master 5e34bec 04/47: Cover malformed defun cases.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 5e34bec7fcfaaaf9c7bd34bd718ea52d2f991dfe
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Cover malformed defun cases.
---
 context-coloring.el   |   36 ++--
 test/context-coloring-test.el |6 +-
 test/fixtures/defun.el|3 +++
 3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 7787cb5..6954b10 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -420,24 +420,24 @@ generated by `js2-mode'."
((context-coloring-emacs-lisp-identifier-syntax-p 
child-1-syntax-code)
 (setq child-1-end (scan-sexps child-1-pos 1))
 ;; defuns are global so use level 0
-(context-coloring-colorize-region child-1-pos child-1-end 0)))
-  (goto-char child-1-end)
-  ;; Lookahead for parameters
-  (skip-syntax-forward " " end)
-  (when (= 4 (logand #x (car (syntax-after (point)
-(setq child-2-end (scan-sexps (point) 1))
-(setq defun-arglist (read (buffer-substring-no-properties
-   (point)
-   child-2-end)))
-(while defun-arglist
-  (setq defun-arg (car defun-arglist))
-  (when (and (symbolp defun-arg)
- (string-match-p "\\`[^&:]" (symbol-name 
defun-arg)))
-(context-coloring-scope-add-variable
- (car scope-stack)
- defun-arg))
-  (setq defun-arglist (cdr defun-arglist
-  (goto-char child-2-end)
+(context-coloring-colorize-region child-1-pos child-1-end 0)
+(goto-char child-1-end)
+;; Lookahead for parameters
+(skip-syntax-forward " " end)
+(when (= 4 (logand #x (car (syntax-after (point)
+  (setq child-2-end (scan-sexps (point) 1))
+  (setq defun-arglist (read (buffer-substring-no-properties
+ (point)
+ child-2-end)))
+  (while defun-arglist
+(setq defun-arg (car defun-arglist))
+(when (and (symbolp defun-arg)
+   (string-match-p "\\`[^&:]" (symbol-name 
defun-arg)))
+  (context-coloring-scope-add-variable
+   (car scope-stack)
+   defun-arg))
+(setq defun-arglist (cdr defun-arglist)))
+  (goto-char child-2-end
   ;; Cleanup
   (setq in-defun-p nil))
  (t
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 8bd91fd..393b4c7 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1015,7 +1015,11 @@ see that function."
   (context-coloring-test-assert-region-level 40 53 1)  ; def ghi jkl
   (context-coloring-test-assert-region-level 53 57 0)  ; free
   (context-coloring-test-assert-region-level 57 59 1)  ; ))
-  (context-coloring-test-assert-region-level 61 72 0)) ; (abc 1 2 3)
+  (context-coloring-test-assert-region-level 61 72 0)  ; (abc 1 2 3)
+  (context-coloring-test-assert-region-level 74 81 1)  ; (defun
+  (context-coloring-test-assert-region-level 81 82 0)  ; a
+  (context-coloring-test-assert-region-level 82 83 1)  ; )
+  (context-coloring-test-assert-region-level 84 94 1)) ; (defun ())
 
 (provide 'context-coloring-test)
 
diff --git a/test/fixtures/defun.el b/test/fixtures/defun.el
index 9ed7b7b..a5bd039 100644
--- a/test/fixtures/defun.el
+++ b/test/fixtures/defun.el
@@ -2,3 +2,6 @@
   (+ def ghi jkl free))
 
 (abc 1 2 3)
+
+(defun a)
+(defun ())



[elpa] master 3fc5b20 27/47: Make dispatches fully redefinable.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 3fc5b201808b57efcab2e4f61e7afdc3cd3009ca
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Make dispatches fully redefinable.
---
 context-coloring.el |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index a513947..d1c2d52 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -864,8 +864,7 @@ interrupted (for synchronous strategies like `:colorizer' 
and
   (error "No colorizer, scopifier or command defined for dispatch"))
 (puthash symbol properties context-coloring-dispatch-hash-table)
 (dolist (mode modes)
-  (when (null (gethash mode context-coloring-mode-hash-table))
-(puthash mode properties context-coloring-mode-hash-table)
+  (puthash mode properties context-coloring-mode-hash-table
 
 
 ;;; Colorization



[elpa] master 438cb33 36/47: Fix incorrect last fontified position.

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit 438cb336604d867478a941d3814eaf820817bf3e
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix incorrect last fontified position.
---
 context-coloring.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ead1a79..585f325 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -492,7 +492,7 @@ provide visually \"instant\" updates at ~60 frames per 
second.")
 (context-coloring-maybe-colorize-comments-and-strings
  last-fontified-position
  end-of-current-defun)
-(setq last-fontified-position end-of-current-defun)
+(setq last-fontified-position (point))
 (when (and context-coloring-parse-interruptable-p
(input-pending-p))
   (throw 'interrupted t)))



[elpa] master b525e2d 47/47: Merge commit '3bf805df83fe6f110f3e7e8ce2dc37e0cf6c14cb' from context-coloring

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit b525e2d04fd260fb6ccebb3355583329edde24f3
Merge: e42b97b 3bf805d
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge commit '3bf805df83fe6f110f3e7e8ce2dc37e0cf6c14cb' from 
context-coloring
---
 packages/context-coloring/README.md|   46 +-
 packages/context-coloring/context-coloring.el  |  751 
 .../context-coloring/test/context-coloring-test.el |  275 +++-
 packages/context-coloring/test/fixtures/comment.el |3 +
 packages/context-coloring/test/fixtures/defun.el   |7 +
 packages/context-coloring/test/fixtures/ignored.el |2 +
 .../context-coloring/test/fixtures/iteration.el|2 +
 packages/context-coloring/test/fixtures/lambda.el  |3 +
 packages/context-coloring/test/fixtures/let*.el|   11 +
 packages/context-coloring/test/fixtures/let.el |8 +
 packages/context-coloring/test/fixtures/quote.el   |4 +
 packages/context-coloring/test/fixtures/string.el  |2 +
 12 files changed, 947 insertions(+), 167 deletions(-)

diff --git a/packages/context-coloring/README.md 
b/packages/context-coloring/README.md
index 6c895de..39c15cf 100644
--- a/packages/context-coloring/README.md
+++ b/packages/context-coloring/README.md
@@ -13,9 +13,12 @@ By default, comments and strings are still highlighted 
syntactically.
 
 ## Features
 
-- Supported languages: JavaScript
 - Light and dark (customizable) color schemes.
-- Very fast for files under 1000 lines.
+- JavaScript support:
+  - Very fast for files under 1000 lines.
+  - Script, function and block scopes (and even `catch` block scopes).
+- Emacs Lisp support:
+  - `defun`, `lambda`, `let`, `let*`, quotes, backticks, commas.
 
 ## Installation
 
@@ -51,7 +54,7 @@ make compile
 (require 'context-coloring)
 ```
 
-### scopifier (for non-js2-mode users)
+### Dependencies (js-mode)
 
 ```bash
 npm install -g scopifier
@@ -62,12 +65,15 @@ npm install -g scopifier
 Add the following to your init file:
 
 ```lisp
-;; non-js2-mode users:
+;; js-mode:
 (add-hook 'js-mode-hook 'context-coloring-mode)
 
-;; js2-mode users:
+;; js2-mode:
 (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
 (add-hook 'js2-mode-hook 'context-coloring-mode)
+
+;; emacs-lisp-mode:
+(add-hook 'emacs-lisp-mode-hook 'context-coloring-mode)
 ```
 
 ## Customizing
@@ -79,7 +85,8 @@ Add the following to your init file:
 - `context-coloring-syntactic-strings` (default: `t`): If non-nil, also color
   strings using `font-lock`.
 - `context-coloring-delay` (default: `0.25`; supported modes: `js-mode`,
-  `js3-mode`): Delay between a buffer update and colorization.
+  `js3-mode`, `emacs-lisp-mode`): Delay between a buffer update and
+  colorization.
 - `context-coloring-js-block-scopes` (default: `nil`; supported modes:
   `js2-mode`): If non-nil, also color block scopes in the scope hierarchy in
   JavaScript.
@@ -96,17 +103,17 @@ You can define your own theme colors too:
 ```lisp
 (context-coloring-define-theme
  'zenburn
- :colors '("#DCDCCC"
-   "#93E0E3"
-   "#BFEBBF"
-   "#F0DFAF"
-   "#DFAF8F"
-   "#CC9393"
-   "#DC8CC3"
-   "#94BFF3"
-   "#9FC59F"
-   "#D0BF8F"
-   "#DCA3A3"))
+ :colors '("#dcdccc"
+   "#93e0e3"
+   "#bfebbf"
+   "#f0dfaf"
+   "#dfaf8f"
+   "#cc9393"
+   "#dc8cc3"
+   "#94bff3"
+   "#9fc59f"
+   "#d0bf8f"
+   "#dca3a3"))
 ```
 
 See `C-h f context-coloring-define-theme` for more info on theme parameters.
@@ -170,6 +177,11 @@ When a `--version` argument is passed, a scopifier should 
print its version
 number and exit.  This allows context-coloring to determine if an update is
 required.
 
+Alternatively, you could implement a "colorizer" in Emacs Lisp.  A colorizer
+also handles the job of calling `context-coloring-colorize-region` to apply
+colors to a buffer.  A colorizer may have better performance than a scopifier
+when parsing and coloring can be performed in the same pass.
+
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier
diff --git a/packages/context-coloring/context-coloring.el 
b/packages/context-coloring/context-coloring.el
index d73773a..cb74ee7 100644
--- a/packages/context-coloring/context-coloring.el
+++ b/packages/context-coloring/context-coloring.el
@@ -3,10 +3,10 @@
 ;; Copyright (C) 2014-2015  Free Software Foundation, Inc.
 
 ;; Author: Jackson Ray Hamilton 
-;; Version: 6.2.1
+;; Version: 6.3.0
 ;; Keywords: convenience faces tools
-;; Homepage: https://github.com/jacksonrayhamil

[elpa] master c6e173b 45/47: Merge branch 'elisp'

2015-05-18 Thread Jackson Ray Hamilton
branch: master
commit c6e173b4d603cdc54080569bbc78038473921a97
Merge: eb429df 3b6a391
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Merge branch 'elisp'
---
 README.md |   24 ++-
 context-coloring.el   |  657 -
 test/context-coloring-test.el |  275 -
 test/fixtures/comment.el  |3 +
 test/fixtures/defun.el|7 +
 test/fixtures/ignored.el  |2 +
 test/fixtures/iteration.el|2 +
 test/fixtures/lambda.el   |3 +
 test/fixtures/let*.el |   11 +
 test/fixtures/let.el  |8 +
 test/fixtures/quote.el|4 +
 test/fixtures/string.el   |2 +
 12 files changed, 894 insertions(+), 104 deletions(-)

diff --git a/README.md b/README.md
index bc21b62..39c15cf 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,12 @@ By default, comments and strings are still highlighted 
syntactically.
 
 ## Features
 
-- Supported languages: JavaScript
 - Light and dark (customizable) color schemes.
-- Very fast for files under 1000 lines.
+- JavaScript support:
+  - Very fast for files under 1000 lines.
+  - Script, function and block scopes (and even `catch` block scopes).
+- Emacs Lisp support:
+  - `defun`, `lambda`, `let`, `let*`, quotes, backticks, commas.
 
 ## Installation
 
@@ -51,7 +54,7 @@ make compile
 (require 'context-coloring)
 ```
 
-### scopifier (for non-js2-mode users)
+### Dependencies (js-mode)
 
 ```bash
 npm install -g scopifier
@@ -62,12 +65,15 @@ npm install -g scopifier
 Add the following to your init file:
 
 ```lisp
-;; non-js2-mode users:
+;; js-mode:
 (add-hook 'js-mode-hook 'context-coloring-mode)
 
-;; js2-mode users:
+;; js2-mode:
 (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
 (add-hook 'js2-mode-hook 'context-coloring-mode)
+
+;; emacs-lisp-mode:
+(add-hook 'emacs-lisp-mode-hook 'context-coloring-mode)
 ```
 
 ## Customizing
@@ -79,7 +85,8 @@ Add the following to your init file:
 - `context-coloring-syntactic-strings` (default: `t`): If non-nil, also color
   strings using `font-lock`.
 - `context-coloring-delay` (default: `0.25`; supported modes: `js-mode`,
-  `js3-mode`): Delay between a buffer update and colorization.
+  `js3-mode`, `emacs-lisp-mode`): Delay between a buffer update and
+  colorization.
 - `context-coloring-js-block-scopes` (default: `nil`; supported modes:
   `js2-mode`): If non-nil, also color block scopes in the scope hierarchy in
   JavaScript.
@@ -170,6 +177,11 @@ When a `--version` argument is passed, a scopifier should 
print its version
 number and exit.  This allows context-coloring to determine if an update is
 required.
 
+Alternatively, you could implement a "colorizer" in Emacs Lisp.  A colorizer
+also handles the job of calling `context-coloring-colorize-region` to apply
+colors to a buffer.  A colorizer may have better performance than a scopifier
+when parsing and coloring can be performed in the same pass.
+
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier
diff --git a/context-coloring.el b/context-coloring.el
index c5c7d3f..5c3b76f 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -47,12 +47,6 @@
 (require 'js2-mode)
 
 
-;;; Local variables
-
-(defvar-local context-coloring-buffer nil
-  "Reference to this buffer (for timers).")
-
-
 ;;; Utilities
 
 (defun context-coloring-join (strings delimiter)
@@ -172,29 +166,29 @@ the END point (exclusive) with the face corresponding to 
LEVEL."
   "Tell `font-lock' to color a string but not a comment."
   (if (nth 3 state) font-lock-string-face nil))
 
-(defsubst context-coloring-maybe-colorize-comments-and-strings ()
+(defsubst context-coloring-maybe-colorize-comments-and-strings (&optional min 
max)
   "Color the current buffer's comments and strings if
 `context-coloring-comments-and-strings' is non-nil."
   (when (or context-coloring-comments-and-strings
 context-coloring-syntactic-comments
 context-coloring-syntactic-strings)
-(let ((old-function font-lock-syntactic-face-function)
-  saved-function-p)
-  (cond
-   ((and context-coloring-syntactic-comments
- (not context-coloring-syntactic-strings))
-(setq font-lock-syntactic-face-function
-  'context-coloring-font-lock-syntactic-comment-function)
-(setq saved-function-p t))
-   ((and context-coloring-syntactic-strings
- (not context-coloring-syntactic-comments))
-(setq font-lock-syntactic-face-function
-  'context-coloring-font-lock-syntactic-string-function)
-(setq saved-function-p t)))
+(let ((min (or min (point-min)))
+  (max (or max (point-max)))
+  (font-lock-syntac

[elpa] master 23cf7b3 09/79: Refactor derived mode tests.

2015-06-13 Thread Jackson Ray Hamilton
branch: master
commit 23cf7b35543c926760c5acba77c1f4f774c06aab
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Refactor derived mode tests.
---
 test/context-coloring-test.el |   50 +---
 1 files changed, 12 insertions(+), 38 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index ebba46d..84b4b08 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -409,25 +409,24 @@ FOREGROUND.  Apply ARGUMENTS to
 (funcall done)))
  (context-coloring-mode
 
-(define-derived-mode
-  context-coloring-change-detection-mode
-  fundamental-mode
-  "Testing"
-  "Prevent `context-coloring-test-change-detection' from
-  having any unintentional side-effects on mode support.")
+(defmacro context-coloring-test-define-derived-mode (name)
+  (let ((name (intern (format "context-coloring-test-%s-mode" name
+`(define-derived-mode ,name fundamental-mode "Testing")))
+
+(context-coloring-test-define-derived-mode change-detection)
 
 ;; Simply cannot figure out how to trigger an idle timer; would much rather 
test
 ;; that.  But (current-idle-time) always returns nil in these tests.
 (ert-deftest-async context-coloring-test-change-detection (done)
   (context-coloring-define-dispatch
  'idle-change
- :modes '(context-coloring-change-detection-mode)
+ :modes '(context-coloring-test-change-detection-mode)
  :executable "node"
  :command "node test/binaries/noop")
   (context-coloring-test-with-fixture-async
"./fixtures/empty"
(lambda (teardown)
- (context-coloring-change-detection-mode)
+ (context-coloring-test-change-detection-mode)
  (add-hook
   'context-coloring-colorize-hook
   (lambda ()
@@ -465,12 +464,7 @@ FOREGROUND.  Apply ARGUMENTS to
 "Context coloring is not available for this major mode"
 "*Messages*")))
 
-(define-derived-mode
-  context-coloring-test-define-dispatch-error-mode
-  fundamental-mode
-  "Testing"
-  "Prevent `context-coloring-test-define-dispatch-error' from
-  having any unintentional side-effects on mode support.")
+(context-coloring-test-define-derived-mode define-dispatch-error)
 
 (ert-deftest context-coloring-test-define-dispatch-error ()
   (context-coloring-test-assert-error
@@ -485,12 +479,7 @@ FOREGROUND.  Apply ARGUMENTS to
   :modes '(context-coloring-test-define-dispatch-error-mode)))
"No colorizer, scopifier or command defined for dispatch"))
 
-(define-derived-mode
-  context-coloring-test-define-dispatch-scopifier-mode
-  fundamental-mode
-  "Testing"
-  "Prevent `context-coloring-test-define-dispatch-scopifier' from
-  having any unintentional side-effects on mode support.")
+(context-coloring-test-define-derived-mode define-dispatch-scopifier)
 
 (ert-deftest context-coloring-test-define-dispatch-scopifier ()
   (context-coloring-define-dispatch
@@ -502,12 +491,7 @@ FOREGROUND.  Apply ARGUMENTS to
 (context-coloring-mode)
 (context-coloring-colorize)))
 
-(define-derived-mode
-  context-coloring-test-missing-executable-mode
-  fundamental-mode
-  "Testing"
-  "Prevent `context-coloring-test-define-dispatch-scopifier' from
-  having any unintentional side-effects on mode support.")
+(context-coloring-test-define-derived-mode missing-executable)
 
 (ert-deftest context-coloring-test-missing-executable ()
   (context-coloring-define-dispatch
@@ -519,12 +503,7 @@ FOREGROUND.  Apply ARGUMENTS to
 (context-coloring-test-missing-executable-mode)
 (context-coloring-mode)))
 
-(define-derived-mode
-  context-coloring-test-unsupported-version-mode
-  fundamental-mode
-  "Testing"
-  "Prevent `context-coloring-test-unsupported-version' from
-  having any unintentional side-effects on mode support.")
+(context-coloring-test-define-derived-mode unsupported-version)
 
 (ert-deftest-async context-coloring-test-unsupported-version (done)
   (context-coloring-define-dispatch
@@ -551,12 +530,7 @@ FOREGROUND.  Apply ARGUMENTS to
 (funcall done)))
  (context-coloring-mode
 
-(define-derived-mode
-  context-coloring-test-disable-mode-mode
-  fundamental-mode
-  "Testing"
-  "Prevent `context-coloring-test-disable-mode' from having any
-  unintentional side-effects on mode support.")
+(context-coloring-test-define-derived-mode disable-mode)
 
 (ert-deftest-async context-coloring-test-disable-mode (done)
   (let (torn-down)



[elpa] master ae03324 05/79: Define js and js2 tests simultaneously.

2015-06-13 Thread Jackson Ray Hamilton
branch: master
commit ae033240e71b1d1a25d1052aa1dca83a10fb56a2
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Define js and js2 tests simultaneously.
---
 test/context-coloring-test.el |  225 +
 1 files changed, 91 insertions(+), 134 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 743aee4..cd2864b 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -172,6 +172,13 @@ initial colorization if colorization should occur."
   :mode 'js2-mode
   :extension "js")
 
+(defmacro context-coloring-test-deftest-js-js2 (&rest args)
+  "Simultaneously define the same test for js and js2."
+  (declare (indent defun))
+  `(progn
+ (context-coloring-test-deftest-js ,@args)
+ (context-coloring-test-deftest-js2 ,@args)))
+
 (context-coloring-test-define-deftest emacs-lisp
   :mode 'emacs-lisp-mode
   :extension "el")
@@ -971,151 +978,101 @@ see that function."
 (context-coloring-test-assert-maximum-face
  maximum-face-value)))
 
-(defun context-coloring-test-js-function-scopes ()
-  (context-coloring-test-assert-region-level 1 9 0)
-  (context-coloring-test-assert-region-level 9 23 1)
-  (context-coloring-test-assert-region-level 23 25 0)
-  (context-coloring-test-assert-region-level 25 34 1)
-  (context-coloring-test-assert-region-level 34 35 0)
-  (context-coloring-test-assert-region-level 35 52 1)
-  (context-coloring-test-assert-region-level 52 66 2)
-  (context-coloring-test-assert-region-level 66 72 1)
-  (context-coloring-test-assert-region-level 72 81 2)
-  (context-coloring-test-assert-region-level 81 82 1)
-  (context-coloring-test-assert-region-level 82 87 2)
-  (context-coloring-test-assert-region-level 87 89 1))
-
-(context-coloring-test-deftest-js function-scopes
-  'context-coloring-test-js-function-scopes)
-(context-coloring-test-deftest-js2 function-scopes
-  'context-coloring-test-js-function-scopes)
-
-(defun context-coloring-test-js-global ()
-  (context-coloring-test-assert-region-level 20 28 1)
-  (context-coloring-test-assert-region-level 28 35 0)
-  (context-coloring-test-assert-region-level 35 41 1))
-
-(context-coloring-test-deftest-js global
-  'context-coloring-test-js-global)
-(context-coloring-test-deftest-js2 global
-  'context-coloring-test-js-global)
-
-(defun context-coloring-test-js-block-scopes ()
-  (context-coloring-colorize)
-  (context-coloring-test-assert-region-level 20 27 1)
-  (context-coloring-test-assert-region-level 27 41 2)
-  (context-coloring-test-assert-region-level 41 42 1)
-  (context-coloring-test-assert-region-level 42 64 2))
+(context-coloring-test-deftest-js-js2 function-scopes
+  (lambda ()
+(context-coloring-test-assert-region-level 1 9 0)
+(context-coloring-test-assert-region-level 9 23 1)
+(context-coloring-test-assert-region-level 23 25 0)
+(context-coloring-test-assert-region-level 25 34 1)
+(context-coloring-test-assert-region-level 34 35 0)
+(context-coloring-test-assert-region-level 35 52 1)
+(context-coloring-test-assert-region-level 52 66 2)
+(context-coloring-test-assert-region-level 66 72 1)
+(context-coloring-test-assert-region-level 72 81 2)
+(context-coloring-test-assert-region-level 81 82 1)
+(context-coloring-test-assert-region-level 82 87 2)
+(context-coloring-test-assert-region-level 87 89 1)))
+
+(context-coloring-test-deftest-js-js2 global
+  (lambda ()
+(context-coloring-test-assert-region-level 20 28 1)
+(context-coloring-test-assert-region-level 28 35 0)
+(context-coloring-test-assert-region-level 35 41 1)))
 
 (context-coloring-test-deftest-js2 block-scopes
-  'context-coloring-test-js-block-scopes
+  (lambda ()
+(context-coloring-colorize)
+(context-coloring-test-assert-region-level 20 27 1)
+(context-coloring-test-assert-region-level 27 41 2)
+(context-coloring-test-assert-region-level 41 42 1)
+(context-coloring-test-assert-region-level 42 64 2))
   :before (lambda ()
 (setq context-coloring-js-block-scopes t))
   :after (lambda ()
(setq context-coloring-js-block-scopes nil)))
 
-(defun context-coloring-test-js-catch ()
-  (context-coloring-test-assert-region-level 20 27 1)
-  (context-coloring-test-assert-region-level 27 51 2)
-  (context-coloring-test-assert-region-level 51 52 1)
-  (context-coloring-test-assert-region-level 52 73 2)
-  (context-coloring-test-assert-region-level 73 101 3)
-  (context-coloring-test-assert-region-level 101 102 1)
-  (context-coloring-test-assert-region-level 102 117 3)
-  (context-coloring-test-assert-region-level 117 123 2))
-
-(context-coloring-test-deftest-js catch
-  'context-coloring-test-js-catch)
-(context-coloring-test-deftest-js2 catch
-  'context-coloring-test-js-catch)
-
-(defun context-coloring-test-js-key-names ()
-  (context-coloring-test-assert-region-le

[elpa] master cfcf112 03/79: Add define-deftest macro.

2015-06-13 Thread Jackson Ray Hamilton
branch: master
commit cfcf1129e326794c6930bf110a0810f114864a12
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add define-deftest macro.
---
 test/context-coloring-test.el |   93 +++--
 1 files changed, 61 insertions(+), 32 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 841587f..2b4b96a 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -37,7 +37,7 @@
   "This file's directory.")
 
 (defun context-coloring-test-read-file (path)
-  "Read a file's contents from PATH into a string."
+  "Return the file's contents from PATH as a string."
   (with-temp-buffer
 (insert-file-contents (expand-file-name path context-coloring-test-path))
 (buffer-string)))
@@ -167,22 +167,51 @@ format."
 ',setup-function-name
 (,function-name)
 
-(cl-defmacro context-coloring-test-deftest-emacs-lisp-mode (name
-body
-&key setup)
-  "Define a test for `emacs-lisp-mode' with name and fixture as
-NAME, with BODY containing the assertions, and SETUP defining the
-environment."
+(cl-defmacro context-coloring-test-define-deftest (name
+   &key mode
+   &key extension)
+  "Define a deftest defmacro for tests prefixed with NAME. MODE
+is called to set up the test's environment.  EXTENSION denotes
+the suffix for tests' fixture files."
   (declare (indent defun))
-  (let ((test-name (intern (format "context-coloring-emacs-lisp-mode-%s" 
name)))
-(fixture (format "./fixtures/%s.el" name)))
-`(ert-deftest ,test-name ()
-   (context-coloring-test-with-fixture
-,fixture
-(emacs-lisp-mode)
-(when ,setup (funcall ,setup))
-(context-coloring-mode)
-(funcall ,body)
+  (let ((macro-name (intern (format "context-coloring-test-deftest-%s" name
+`(cl-defmacro ,macro-name (name
+   body
+   &key fixture
+   &key before
+   &key after)
+   ,(format "Define a test for `%s' suffixed with NAME.
+Function BODY makes assertions.  The default fixture has a
+filename matching NAME (plus the filetype extension, \"%s\"),
+unless FIXTURE is specified to override it.  Functions BEFORE
+and AFTER run before and after the test, even if an error is
+signaled.
+
+BODY is run after `context-coloring-mode' is activated, or after
+initial colorization if colorization should occur."
+(cadr mode) extension)
+   (declare (indent defun))
+   ;; Commas in nested backquotes are not evaluated.  Binding the mode here
+   ;; is probably the cleanest workaround.
+   (let ((mode ,mode)
+ (test-name (intern (format ,(format "%s-%%s" name) name)))
+ (fixture (cond
+   (fixture (format "./fixtures/%s" fixture))
+   (t (format "./fixtures/%s.el" name)
+ `(ert-deftest ,test-name ()
+(context-coloring-test-with-fixture
+ ,fixture
+ (,mode)
+ (when ,before (funcall ,before))
+ (context-coloring-mode)
+ (unwind-protect
+ (progn
+   (funcall ,body))
+   (when ,after (funcall ,after)
+
+(context-coloring-test-define-deftest emacs-lisp
+  :mode 'emacs-lisp-mode
+  :extension "el")
 
 
 ;;; Assertion functions
@@ -1128,7 +1157,7 @@ see that function."
 
 (context-coloring-test-deftest-js2-mode unterminated-comment)
 
-(context-coloring-test-deftest-emacs-lisp-mode defun
+(context-coloring-test-deftest-emacs-lisp defun
   (lambda ()
 (context-coloring-test-assert-coloring "
 11 000  111 1 
@@ -1139,14 +1168,14 @@ see that function."
 11 01
 11 111")))
 
-(context-coloring-test-deftest-emacs-lisp-mode lambda
+(context-coloring-test-deftest-emacs-lisp lambda
   (lambda ()
 (context-coloring-test-assert-coloring "
  111 
 11 222 
  222 22 12 2221 111 0 00")))
 
-(context-coloring-test-deftest-emacs-lisp-mode quote
+(context-coloring-test-deftest-emacs-lisp quote
   (lambda ()
 (context-coloring-test-assert-coloring "
 (x x (x)
@@ -1154,31 +1183,31 @@ see that function."
   11 1 111 111
   11 1 11 11 111 1 111 1 1 1 11 1 1 1")))
 
-(context-coloring-test-deftest-emacs-lisp-mode comment
+(context-coloring-t

[elpa] master 5e0a0d9 10/79: Newlines.

2015-06-13 Thread Jackson Ray Hamilton
branch: master
commit 5e0a0d93ffc4e020f053a72ec54616c5fea80e48
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Newlines.
---
 test/context-coloring-test.el |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 84b4b08..d43a716 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -599,8 +599,7 @@ function."
'((theme-face context-coloring-level-0-face)
  (theme-face face)))
   (context-coloring-test-assert-not-theme-originally-set-p
-   '((theme-face face)))
-  )
+   '((theme-face face
 
 (defun context-coloring-test-assert-theme-settings-highest-level
 (settings expected-level)
@@ -648,8 +647,7 @@ function."
   (context-coloring-test-assert-theme-settings-highest-level
'((theme-face context-coloring-level-0-face)
  (theme-face context-coloring-level-1-face))
-   1)
-  )
+   1))
 
 (defmacro context-coloring-test-deftest-define-theme (name &rest body)
   "Define a test with name NAME and an automatically-generated



[elpa] master c337716 01/79: Add statistics.

2015-06-13 Thread Jackson Ray Hamilton
branch: master
commit c337716cb9a0bbf51dc1e437905d1db48fb578fb
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Add statistics.
---
 README.md |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index 39c15cf..4643cad 100644
--- a/README.md
+++ b/README.md
@@ -15,10 +15,11 @@ By default, comments and strings are still highlighted 
syntactically.
 
 - Light and dark (customizable) color schemes.
 - JavaScript support:
-  - Very fast for files under 1000 lines.
   - Script, function and block scopes (and even `catch` block scopes).
+  - Very fast for files under 1000 lines.
 - Emacs Lisp support:
   - `defun`, `lambda`, `let`, `let*`, quotes, backticks, commas.
+  - 25,000 lines per second!
 
 ## Installation
 



  1   2   3   4   5   6   7   >