;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
;; Author: Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>
-;; Version: 7.2.1
+;; Version: 8.0.1
;; Keywords: convenience faces tools
;; Package-Requires: ((emacs "24.3"))
;; URL: https://github.com/jacksonrayhamilton/context-coloring
:type 'float
:group 'context-coloring)
-(make-obsolete-variable
- 'context-coloring-delay
- 'context-coloring-default-delay
- "6.4.0")
-
(defun context-coloring-cancel-timer (timer)
"Cancel TIMER."
(when timer
end
`(face ,(context-coloring-bounded-level-face level))))
-(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'."
:type 'boolean
"Color a string according to STATE."
(if (nth 3 state) font-lock-string-face nil))
-(defsubst context-coloring-colorize-comments-and-strings (&optional min max)
+(defsubst context-coloring-colorize-comments-and-strings (&optional min max keywords-p)
"Maybe color comments and strings in buffer from MIN to MAX.
-MIN defaults to beginning of buffer. MAX defaults to end."
+MIN defaults to beginning of buffer. MAX defaults to end. If
+KEYWORDS-P is non-nil, also color keywords from MIN to MAX."
(when (or context-coloring-syntactic-comments
context-coloring-syntactic-strings)
(let ((min (or min (point-min)))
font-lock-syntactic-face-function))))
(save-excursion
(font-lock-fontify-syntactically-region min max)
- ;; TODO: Make configurable at the dispatch level.
- (when (eq major-mode 'emacs-lisp-mode)
+ (when keywords-p
(font-lock-fontify-keywords-region min max))))))
(defcustom context-coloring-initial-level 0
(setq ignore-p (funcall (pop predicates))))
ignore-p))
-(defvar context-coloring-parse-interruptable-p t
- "Set this to nil to force parse to continue until finished.")
+(defvar context-coloring-interruptable-p t
+ "When non-nil, coloring may be interrupted by user input.")
;;;###autoload
(define-minor-mode context-coloring-mode
nil " Context" nil
(cond
(context-coloring-mode
- ;; Font lock is incompatible with this mode; the converse is also true.
- (font-lock-mode 0)
- (jit-lock-mode nil)
- ;; ...but we do use font-lock functions here.
- (font-lock-set-defaults)
- ;; Safely change the value of this function as necessary.
- (make-local-variable 'font-lock-syntactic-face-function)
(let ((dispatch (context-coloring-get-current-dispatch)))
(cond
(dispatch
+ ;; Font lock is incompatible with this mode; the converse is also true.
+ (font-lock-mode 0)
+ ;; ...but we do use font-lock functions here.
+ (font-lock-set-defaults)
+ ;; Safely change the value of this function as necessary.
+ (make-local-variable 'font-lock-syntactic-face-function)
(let ((setup (plist-get dispatch :setup)))
(when setup
(funcall setup))
;; Colorize once initially.
- (let ((context-coloring-parse-interruptable-p nil))
+ (let ((context-coloring-interruptable-p nil))
(context-coloring-colorize))))
((not (context-coloring-ignore-unavailable-message-p))
(message "Context coloring is unavailable here")))))
(let ((teardown (plist-get dispatch :teardown)))
(when teardown
(funcall teardown)))))
- (font-lock-mode)
- (jit-lock-mode t))))
+ (turn-on-font-lock-if-desired))))
(provide 'context-coloring)