"Move forward through whitespace and comments."
(while (forward-comment 1)))
+(defsubst context-coloring-elisp-forward-sws ()
+ "Move forward through whitespace and comments, colorizing
+them along the way."
+ (let ((start (point)))
+ (context-coloring-forward-sws)
+ (context-coloring-elisp-colorize-comments-and-strings-in-region
+ start (point))))
+
(defsubst context-coloring-get-syntax-code ()
(syntax-class
;; Faster version of `syntax-after':
(defun context-coloring-elisp-colorize-let* ()
(context-coloring-elisp-colorize-defun-like t 'let*))
+(defun context-coloring-elisp-colorize-cond ()
+ (let (syntax-code)
+ ;; Enter.
+ (forward-char)
+ (context-coloring-elisp-forward-sws)
+ ;; Skip past the "cond".
+ (skip-syntax-forward "^w_")
+ (context-coloring-elisp-forward-sws)
+ (while (/= (setq syntax-code (context-coloring-get-syntax-code))
+ context-coloring-CLOSE-PARENTHESIS-CODE)
+ (cond
+ ((= syntax-code context-coloring-OPEN-PARENTHESIS-CODE)
+ ;; Colorize inside the parens.
+ (let ((start (point)))
+ (forward-sexp)
+ (context-coloring-elisp-colorize-region
+ (1+ start) (1- (point)))
+ ;; Exit.
+ (forward-char)))
+ (t
+ (forward-sexp)))
+ (context-coloring-elisp-forward-sws))
+ ;; Exit.
+ (forward-char)))
+
(defun context-coloring-elisp-colorize-parenthesized-sexp ()
(context-coloring-elisp-increment-sexp-count)
(let* ((start (point))
(goto-char start)
(context-coloring-elisp-colorize-lambda)
t)
+ ((string-equal "cond" name-string)
+ (goto-char start)
+ (context-coloring-elisp-colorize-cond)
+ t)
(t
nil)))))
;; Not a special form; just colorize the remaining region.
2222 1 1 2 2 2 000022
1111 1 1 1 0 0 000011")))
+(context-coloring-test-deftest-emacs-lisp cond
+ (lambda ()
+ (context-coloring-test-assert-coloring "
+(xxx (x)
+ 11111
+ 11 11
+ 10000 11
+ 1111 1 00001 11
+ 11 11111 1 0000111)")))
+
(defun context-coloring-test-insert-unread-space ()
"Simulate the insertion of a space as if by a user."
(setq unread-command-events (cons '(t . 32)