[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5857bc8 53/79: Refactor comments and strings coloring.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 5857bc8 53/79: Refactor comments and strings coloring. |
Date: |
Sun, 14 Jun 2015 00:05:39 +0000 |
branch: master
commit 5857bc81ea0c7644db489aa714717f4024473a69
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Refactor comments and strings coloring.
---
context-coloring.el | 59 ++++++++++++++++++++++++++------------------------
1 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index afc05e4..b14c63e 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -285,8 +285,7 @@ generated by `js2-mode'."
them along the way."
(let ((start (point)))
(context-coloring-forward-sws)
- (context-coloring-elisp-colorize-comments-and-strings-in-region
- start (point))))
+ (context-coloring-maybe-colorize-comments-and-strings start (point))))
(defsubst context-coloring-elisp-forward-sexp ()
"Like `forward-sexp', but colorize comments and strings along
@@ -438,18 +437,18 @@ provide visually \"instant\" updates at 60 frames per
second.")
(cond
((= syntax-code context-coloring-OPEN-PARENTHESIS-CODE)
(forward-char)
- (context-coloring-forward-sws)
+ (context-coloring-elisp-forward-sws)
(setq syntax-code (context-coloring-get-syntax-code))
(when (or (= syntax-code context-coloring-WORD-CODE)
(= syntax-code context-coloring-SYMBOL-CODE))
(context-coloring-elisp-parse-arg
(lambda (var)
(push var varlist)))
- (context-coloring-forward-sws)
+ (context-coloring-elisp-forward-sws)
(setq syntax-code (context-coloring-get-syntax-code))
(when (/= syntax-code context-coloring-CLOSE-PARENTHESIS-CODE)
(context-coloring-elisp-colorize-sexp)))
- (context-coloring-forward-sws)
+ (context-coloring-elisp-forward-sws)
;; Skip past the closing parenthesis.
(forward-char))
((or (= syntax-code context-coloring-WORD-CODE)
@@ -459,7 +458,7 @@ provide visually \"instant\" updates at 60 frames per
second.")
(push var varlist)))))
(when (eq type 'let*)
(context-coloring-elisp-add-variable (pop varlist)))
- (context-coloring-forward-sws))
+ (context-coloring-elisp-forward-sws))
(when (eq type 'let)
(while varlist
(context-coloring-elisp-add-variable (pop varlist))))
@@ -479,8 +478,8 @@ provide visually \"instant\" updates at 60 frames per
second.")
(lambda (arg)
(context-coloring-elisp-add-variable arg))))
(t
- (forward-sexp)))
- (context-coloring-forward-sws))
+ (context-coloring-elisp-forward-sexp)))
+ (context-coloring-elisp-forward-sws))
;; Exit.
(forward-char)))
@@ -501,10 +500,12 @@ provide visually \"instant\" updates at 60 frames per
second.")
end
(context-coloring-elisp-current-scope-level))
(goto-char start)
+ ;; Enter.
+ (forward-char)
+ (context-coloring-elisp-forward-sws)
;; Skip past the "defun".
- (skip-syntax-forward "^w_")
(forward-sexp)
- (context-coloring-forward-sws)
+ (context-coloring-elisp-forward-sws)
(setq stop nil)
(unless anonymous-p
;; Check for the defun's name.
@@ -517,14 +518,14 @@ provide visually \"instant\" updates at 60 frames per
second.")
(forward-sexp)
(setq defun-name-end (point))
(context-coloring-colorize-region defun-name-pos defun-name-end 0)
- (context-coloring-forward-sws))
+ (context-coloring-elisp-forward-sws))
(t
(setq stop t))))
(cond
(stop
;; Skip it.
(goto-char start)
- (forward-sexp))
+ (context-coloring-elisp-forward-sexp))
(t
(setq syntax-code (context-coloring-get-syntax-code))
(cond
@@ -541,9 +542,8 @@ provide visually \"instant\" updates at 60 frames per
second.")
(t
;; Skip it.
(goto-char start)
- (forward-sexp)))))
- (context-coloring-elisp-pop-scope)
- (context-coloring-elisp-colorize-comments-and-strings-in-region start
end)))
+ (context-coloring-elisp-forward-sexp)))))
+ (context-coloring-elisp-pop-scope)))
(defun context-coloring-elisp-colorize-defun ()
(context-coloring-elisp-colorize-defun-like))
@@ -563,7 +563,7 @@ provide visually \"instant\" updates at 60 frames per
second.")
(forward-char)
(context-coloring-elisp-forward-sws)
;; Skip past the "cond".
- (skip-syntax-forward "^w_")
+ (forward-sexp)
(context-coloring-elisp-forward-sws)
(while (/= (setq syntax-code (context-coloring-get-syntax-code))
context-coloring-CLOSE-PARENTHESIS-CODE)
@@ -577,7 +577,7 @@ provide visually \"instant\" updates at 60 frames per
second.")
;; Exit.
(forward-char)))
(t
- (forward-sexp)))
+ (context-coloring-elisp-forward-sexp)))
(context-coloring-elisp-forward-sws))
;; Exit.
(forward-char)))
@@ -653,6 +653,8 @@ provide visually \"instant\" updates at 60 frames per
second.")
(point)))
(syntax-code (progn (goto-char start)
(forward-char)
+ ;; Coloring is unnecessary here, it'll happen
+ ;; presently.
(context-coloring-forward-sws)
(context-coloring-get-syntax-code))))
;; Figure out if the sexp is a special form.
@@ -719,14 +721,16 @@ provide visually \"instant\" updates at 60 frames per
second.")
(defun context-coloring-elisp-colorize-expression-prefix ()
(context-coloring-elisp-increment-sexp-count)
(let ((char (char-after))
- (start (point))
- (end (progn (forward-sexp)
- (point))))
+ start
+ end)
(cond
((or (= char context-coloring-APOSTROPHE-CHAR)
(= char context-coloring-OCTOTHORPE-CHAR))
- (context-coloring-elisp-colorize-comments-and-strings-in-region start
end))
+ (context-coloring-elisp-forward-sexp))
((= char context-coloring-BACKTICK-CHAR)
+ (setq start (point))
+ (setq end (progn (forward-sexp)
+ (point)))
(goto-char start)
(while (> end (progn (forward-char)
(point)))
@@ -736,17 +740,16 @@ provide visually \"instant\" updates at 60 frames per
second.")
(when (= (char-after) context-coloring-AT-CHAR)
;; If we don't do this "@" could be interpreted as a symbol.
(forward-char))
- (context-coloring-forward-sws)
+ (context-coloring-elisp-forward-sws)
(context-coloring-elisp-colorize-sexp)))
- (context-coloring-elisp-colorize-comments-and-strings-in-region start
end)))))
+ ;; We could probably do this as part of the above loop but it'd be
+ ;; repetitive.
+ (context-coloring-elisp-colorize-comments-and-strings-in-region
+ start end)))))
(defun context-coloring-elisp-colorize-comment ()
(context-coloring-elisp-increment-sexp-count)
- (let ((start (point)))
- (context-coloring-forward-sws)
- (context-coloring-maybe-colorize-comments-and-strings
- start
- (point))))
+ (context-coloring-elisp-forward-sws))
(defun context-coloring-elisp-colorize-string ()
(context-coloring-elisp-increment-sexp-count)
- [elpa] master 233ea1a 47/79: Kill any scopifier server before running the tests., (continued)
- [elpa] master 233ea1a 47/79: Kill any scopifier server before running the tests., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 0079778 48/79: Set `:send-report' to nil., Jackson Ray Hamilton, 2015/06/13
- [elpa] master cacf5de 49/79: Add cond support., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 8d15938 43/79: Cleaner server implementation., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 89286b6 54/79: Cleanup., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 5f9bd49 50/79: Add comments and strings to the cond test., Jackson Ray Hamilton, 2015/06/13
- [elpa] master c2834f0 51/79: Add condition-case support., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 2ee41c1 52/79: Add comments and strings to condition-case test., Jackson Ray Hamilton, 2015/06/13
- [elpa] master e387aaf 45/79: Merge branch 'server' into elisp, Jackson Ray Hamilton, 2015/06/13
- [elpa] master 77b075f 60/79: Space., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 5857bc8 53/79: Refactor comments and strings coloring.,
Jackson Ray Hamilton <=
- [elpa] master 4bd7fc7 56/79: Make delays configurable at the dispatch level., Jackson Ray Hamilton, 2015/06/13
- [elpa] master f870598 59/79: Fix infinite loop when parsing let., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 3c7a00d 55/79: Add lazy coloring., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 08e2981 63/79: Swallow scan errors., Jackson Ray Hamilton, 2015/06/13
- [elpa] master ec9f04d 64/79: Update emacs lisp support in readme., Jackson Ray Hamilton, 2015/06/13
- [elpa] master d2e08e8 62/79: Improve and test lazy coloring., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 46a9193 65/79: Find the edges of the screen more efficiently., Jackson Ray Hamilton, 2015/06/13
- [elpa] master fd4bc95 66/79: Add dolist support., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 9edc6c3 69/79: Checkdoc cleanup., Jackson Ray Hamilton, 2015/06/13
- [elpa] master e2ceef9 57/79: Prepend function symbols with octothorpes., Jackson Ray Hamilton, 2015/06/13