branch: master commit fc81cf9d788349fcafffb8fa91ea7b84839e0860 Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Don't use timers for js2-mode. --- context-coloring.el | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index 61d3807..986d90d 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -458,16 +458,18 @@ colorizing would be redundant." (context-coloring-colorize) ;; (message "Elapsed time: %f" (- (float-time) start-time))) - ;; Only recolor on change. (cond ((equal major-mode 'js2-mode) - (add-hook 'js2-post-parse-callbacks 'context-coloring-change-function nil t)) + ;; Only recolor on reparse. + (add-hook 'js2-post-parse-callbacks 'context-coloring-colorize nil t)) (t + ;; Only recolor on change. (add-hook 'after-change-functions 'context-coloring-change-function nil t))) - ;; Only recolor idly. - (setq context-coloring-colorize-idle-timer - (run-with-idle-timer context-coloring-delay t 'context-coloring-maybe-colorize)))) + (when (not (equal major-mode 'js2-mode)) + ;; Only recolor idly. + (setq context-coloring-colorize-idle-timer + (run-with-idle-timer context-coloring-delay t 'context-coloring-maybe-colorize))))) (provide 'context-coloring)