emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 4c5f3ab 145/271: Fix first-run bug, passing js2-mode test.


From: Jackson Ray Hamilton
Subject: [elpa] master 4c5f3ab 145/271: Fix first-run bug, passing js2-mode test.
Date: Thu, 05 Feb 2015 18:30:38 +0000

branch: master
commit 4c5f3ab1bff4707acdccea1191839f5943efbf08
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Fix first-run bug, passing js2-mode test.
---
 context-coloring.el           |   34 +++++++++++++++++++---------------
 test/context-coloring-test.el |    4 +---
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 3f8b978..92b93a1 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -225,18 +225,22 @@ imply that it should be colorized again.")
 
 ;;; Scopification
 
-(let ((javascript-scopifier `(:type shell-command
-                              :executable "node"
-                              :command ,(expand-file-name
-                                         "./languages/javascript/bin/scopifier"
-                                         context-coloring-path)))
-      (js2-scopifier `(:type elisp
-                       :scopifier context-coloring-js2-scopifier)))
-  (defcustom context-coloring-scopifier-plist
-    `(js-mode ,javascript-scopifier
-      js2-mode ,js2-scopifier
-      js3-mode ,javascript-scopifier)
-    "Property list mapping major modes to scopification programs."))
+(defvar context-coloring-javascript-scopifier
+  `(:type shell-command
+          :executable "node"
+          :command ,(expand-file-name
+                     "./languages/javascript/bin/scopifier"
+                     context-coloring-path)))
+
+(defvar context-coloring-js2-scopifier
+  `(:type elisp
+          :scopifier context-coloring-js2-scopifier))
+
+(defcustom context-coloring-scopifier-plist
+  `(js-mode ,context-coloring-javascript-scopifier
+            js2-mode ,context-coloring-js2-scopifier
+            js3-mode ,context-coloring-javascript-scopifier)
+  "Property list mapping major modes to scopification programs.")
 
 (defun context-coloring-apply-tokens (tokens)
   "Processes a vector of TOKENS to apply context-based coloring
@@ -372,13 +376,13 @@ colorizing would be redundant."
     ;; Remember this buffer. This value should not be dynamically-bound.
     (setq context-coloring-buffer (current-buffer))
 
-    ;; Colorize once initially.
-    (context-coloring-colorize)
-
     ;; Font lock is incompatible with this mode; the converse is also true.
     (font-lock-mode 0)
     (jit-lock-mode nil)
 
+    ;; Colorize once initially.
+    (context-coloring-colorize)
+
     ;; Only recolor on change.
     (add-hook 'after-change-functions 'context-coloring-change-function nil t)
 
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index b5ee05a..7c8709f 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -39,7 +39,6 @@ FIXTURE."
 (ert-deftest context-coloring-test-unsupported-mode ()
   (context-coloring-test-with-fixture
    "./fixtures/function-scopes.js"
-
    (context-coloring-mode)
    (context-coloring-test-message-should-be
     "Context coloring is not available for this major mode")))
@@ -63,7 +62,7 @@ FIXTURE."
    "./fixtures/function-scopes.js"
    (js-mode)
    (context-coloring-mode)
-   (sleep-for .25) ; Wait for asynchronous coloring.
+   (sleep-for .1) ; Wait for asynchronous coloring.
    (context-coloring-test-function-scopes)))
 
 (ert-deftest context-coloring-test-js2-mode-function-scopes ()
@@ -73,7 +72,6 @@ FIXTURE."
    (require 'js2-mode)
    (js2-mode)
    (context-coloring-mode)
-   (sleep-for .25) ; Wait for asynchronous coloring.
    (context-coloring-test-function-scopes)))
 
 (provide 'context-coloring-test)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]