branch: master
commit 6a2a7df3a7c2986ef4deeabea3ab1020bff9d231
Author: Jackson Ray Hamilton <[email protected]>
Commit: Jackson Ray Hamilton <[email protected]>
Use idle timers instead of font lock.
---
context-coloring.el | 10 ++++------
test/fixtures/monad.js | 24 ++++++++++++++++--------
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 6e5a2ba..1785ccb 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -89,7 +89,7 @@ For example: 'context-coloring-depth-1-face'."
(let ((start (cdr (assoc 's token)))
(end (cdr (assoc 'e token)))
(face (context-coloring-level-face (cdr (assoc 'l token)))))
- (add-text-properties start end `(font-lock-face ,face rear-nonsticky
t))))))
+ (add-text-properties start end `(face ,face rear-nonsticky t))))))
(defun context-coloring-tokenizer-filter (process chunk)
(setq context-coloring-tokenizer-output
@@ -119,9 +119,6 @@ For example: 'context-coloring-depth-1-face'."
(interactive)
(context-coloring-tokenize))
-(defun context-coloring-fontify-region (start end)
- (context-coloring-tokenize))
-
;;; Minor mode
@@ -131,9 +128,10 @@ For example: 'context-coloring-depth-1-face'."
nil " Context" nil
(if (not context-coloring-mode)
(progn
- (jit-lock-unregister 'context-coloring-fontify-region))
+ (cancel-timer context-coloring-colorize-buffer-timer))
(set (make-local-variable 'context-coloring-tokenizer-output) nil)
- (jit-lock-register 'context-coloring-fontify-region)))
+ (set (make-local-variable 'context-coloring-colorize-buffer-timer)
+ (run-with-idle-timer 0.25 t 'context-coloring-colorize-buffer))))
;;;###autoload
(defun context-coloring-mode-enable ()
diff --git a/test/fixtures/monad.js b/test/fixtures/monad.js
index 4a2e19c..ed47fa0 100644
--- a/test/fixtures/monad.js
+++ b/test/fixtures/monad.js
@@ -1,9 +1,17 @@
-function MONAD() {
- return function unit(value) {
- var monad = Object.create(null);
- monad.bind = function (func) {
- return func(value);
+(function () {
+
+ 'use strict';
+
+ function MONAD() {
+ return function unit(value) {
+ var monad = Object.create(null);
+ monad.bind = function (func) {
+ return func(value);
+ };
+ return monad;
};
- return monad;
- };
-}
+ }
+
+ return MONAD;
+
+}());