"Move forward through whitespace and comments."
(while (forward-comment 1)))
+(defsubst context-coloring-elisp-colorize-comments-and-strings
+ (&optional min max)
+ "Color comments and strings from MIN to MAX."
+ (context-coloring-colorize-comments-and-strings min max t))
+
(defsubst context-coloring-elisp-forward-sws ()
"Move through whitespace and comments, coloring comments."
(let ((start (point)))
(context-coloring-forward-sws)
- (context-coloring-colorize-comments-and-strings start (point))))
+ (context-coloring-elisp-colorize-comments-and-strings start (point))))
(defsubst context-coloring-elisp-forward-sexp ()
"Skip/ignore missing sexps, coloring comments and strings."
(context-coloring-elisp-increment-sexp-count)
(let ((start (point)))
(forward-sexp)
- (context-coloring-colorize-comments-and-strings start (point))))
+ (context-coloring-elisp-colorize-comments-and-strings start (point))))
;; Elisp has whitespace, words, symbols, open/close parenthesis, expression
;; prefix, string quote, comment starters/enders and escape syntax classes only.
(cond
;; Just colorize the changed region.
(context-coloring-changed-p
- (let* ( ;; Prevent `beginning-of-defun' from making poor assumptions.
+ (let* (;; Prevent `beginning-of-defun' from making poor assumptions.
(open-paren-in-column-0-is-defun-start nil)
;; Seek the beginning and end of the previous and next
;; offscreen defuns, so just enough is colored.
(t
(context-coloring-elisp-colorize-region-initially (point-min) (point-max)))))))
-(context-coloring-define-dispatch
+;;;###autoload
+(puthash
'emacs-lisp
- :modes '(emacs-lisp-mode lisp-interaction-mode)
- :colorizer #'context-coloring-elisp-colorize
- :delay 0.016 ;; Thanks to lazy colorization this can be 60 frames per second.
- :setup #'context-coloring-setup-idle-change-detection
- :teardown #'context-coloring-teardown-idle-change-detection)
+ (list :modes '(emacs-lisp-mode lisp-interaction-mode)
+ :colorizer #'context-coloring-elisp-colorize
+ :delay 0.016 ;; Thanks to lazy colorization this can be 60 frames per second.
+ :setup #'context-coloring-setup-idle-change-detection
+ :teardown #'context-coloring-teardown-idle-change-detection)
+ context-coloring-dispatch-hash-table)
;;; eval-expression colorization
;; `eval-expression-minibuffer-setup-hook' is not available in Emacs 24.3, so
;; the backwards-compatible recommendation is to use `minibuffer-setup-hook' and
;; rely on this predicate instead.
+;;;###autoload
(defun context-coloring-eval-expression-predicate ()
"Non-nil if the minibuffer is for `eval-expression'."
;; Kinda better than checking `this-command', because `this-command' changes.
(context-coloring-eval-expression-match))
-(context-coloring-define-dispatch
+;;;###autoload
+(puthash
'eval-expression
- :predicate #'context-coloring-eval-expression-predicate
- :colorizer #'context-coloring-eval-expression-colorize
- :delay 0.016
- :setup #'context-coloring-setup-idle-change-detection
- :teardown #'context-coloring-teardown-idle-change-detection)
+ (list :predicate #'context-coloring-eval-expression-predicate
+ :colorizer #'context-coloring-eval-expression-colorize
+ :delay 0.016
+ :setup #'context-coloring-setup-idle-change-detection
+ :teardown #'context-coloring-teardown-idle-change-detection)
+ context-coloring-dispatch-hash-table)
(provide 'context-coloring-emacs-lisp)