branch: master commit 809d48b47b5c86d436846bb184a5e5bd3d8cf275 Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Minor tweaks. --- context-coloring.el | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index feba386..03b43b6 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -135,13 +135,10 @@ calling FUNCTION with the parsed list of tokens." (interactive) (context-coloring-tokenize 'context-coloring-apply-tokens)) -(defun context-coloring-idle-timer () +(defun context-coloring-colorize-if-current () (when (eq context-coloring-buffer (window-buffer (selected-window))) (context-coloring-colorize-buffer))) -(defun context-coloring-after-change (start end length) - (setq context-coloring-changed t)) - ;;; Minor mode @@ -151,7 +148,8 @@ calling FUNCTION with the parsed list of tokens." nil " Context" nil (if (not context-coloring-mode) (progn - (cancel-timer context-coloring-colorize-buffer-timer)) + (when (boundp 'context-coloring-colorize-idle-timer) + (cancel-timer context-coloring-colorize-idle-timer))) ;; Colorize once initially. Why this doesn't work, I cannot say. ;; (context-coloring-colorize-buffer) @@ -160,8 +158,8 @@ calling FUNCTION with the parsed list of tokens." (set (make-local-variable 'context-coloring-buffer) (current-buffer)) ;; Only recolor idly. - (set (make-local-variable 'context-coloring-colorize-buffer-timer) - (run-with-idle-timer 1 t 'context-coloring-idle-timer)))) + (set (make-local-variable 'context-coloring-colorize-idle-timer) + (run-with-idle-timer 1 t 'context-coloring-colorize-if-current)))) ;;;###autoload (defun context-coloring-mode-enable ()