[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e06f1a6 27/79: Color comments and strings inside quotes.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master e06f1a6 27/79: Color comments and strings inside quotes. |
Date: |
Sun, 14 Jun 2015 00:05:26 +0000 |
branch: master
commit e06f1a6194abaec8dffd684b75c805500b7191b6
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Color comments and strings inside quotes.
---
context-coloring.el | 27 +++++++++++++++++++--------
test/context-coloring-test.el | 6 +++++-
test/fixtures/quote.el | 4 ++++
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 459aca0..9b53fd1 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -593,18 +593,15 @@ generated by `js2-mode'."
symbol-string))))))
(defun context-coloring-elisp-colorize-expression-prefix ()
- (let (start
- end
- char)
- (setq char (char-after))
+ (let ((char (char-after))
+ (start (point))
+ (end (progn (forward-sexp)
+ (point))))
(cond
((or (= char context-coloring-APOSTROPHE-CHAR)
(= char context-coloring-OCTOTHORPE-CHAR))
- (forward-sexp))
+ (context-coloring-elisp-colorize-comments-and-strings-in-region start
end))
((= char context-coloring-BACKTICK-CHAR)
- (setq start (point))
- (forward-sexp)
- (setq end (point))
(goto-char start)
(while (> end (progn (forward-char)
(point)))
@@ -668,6 +665,20 @@ provide visually \"instant\" updates at 60 frames per
second.")
start
(point))))
+(defun context-coloring-elisp-colorize-comments-and-strings-in-region (start
end)
+ (let (syntax-code)
+ (goto-char start)
+ (while (> end (progn (skip-syntax-forward "^<\"" end)
+ (point)))
+ (setq syntax-code (context-coloring-get-syntax-code))
+ (cond
+ ((= syntax-code context-coloring-COMMENT-START-CODE)
+ (context-coloring-elisp-colorize-comment))
+ ((= syntax-code context-coloring-STRING-QUOTE-CODE)
+ (context-coloring-elisp-colorize-string))
+ (t
+ (forward-char))))))
+
(defun context-coloring-elisp-colorize-region (start end)
(let (syntax-code)
(goto-char start)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 2a9cdd0..2f519f9 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1099,7 +1099,11 @@ ssssssssssss0"))
(xxxxx x (x)
(xx (xx x 111
111111 1 111 111
- 111111 1 1111111111 11 111 1 111 1 00001 10000 11 00001 1 100001111")))
+ 111111 1 1111111111 11 111 1 111 1 00001 10000 11 00001 1 100001111
+
+(xxxxxx '(sss cc
+ sss cc
+ ))")))
(context-coloring-test-deftest-emacs-lisp comment
(lambda ()
diff --git a/test/fixtures/quote.el b/test/fixtures/quote.el
index 654bc70..8a282da 100644
--- a/test/fixtures/quote.el
+++ b/test/fixtures/quote.el
@@ -2,3 +2,7 @@
(or (eq a 'b)
(equal a '(a b))
(equal a `(,(append () `(a b ,(+ 1 free) ,free b) free) b ,free))))
+
+(append '("a" ; b
+ "b" ; a
+ ))
- [elpa] master f1ed39f 21/79: Pass comment and string tests with recursive colorizer., (continued)
- [elpa] master f1ed39f 21/79: Pass comment and string tests with recursive colorizer., Jackson Ray Hamilton, 2015/06/13
- [elpa] master d146af8 23/79: Fix string coloring., Jackson Ray Hamilton, 2015/06/13
- [elpa] master aaf4835 20/79: Remove let-varlist data structure. Cleanup., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 49265ab 25/79: Simplify comment and string parsing., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 52383b5 26/79: Handle octothorpes., Jackson Ray Hamilton, 2015/06/13
- [elpa] master a283883 24/79: Always colorize the remaining region., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 3d3c693 22/79: Pass interrupt test with recursive colorizer., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 966bd20 31/79: Add test for escape characters., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 7ab01e3 30/79: Fix ignored test., Jackson Ray Hamilton, 2015/06/13
- [elpa] master f88e21c 29/79: Ignore escaped characters., Jackson Ray Hamilton, 2015/06/13
- [elpa] master e06f1a6 27/79: Color comments and strings inside quotes.,
Jackson Ray Hamilton <=
- [elpa] master 5a8186b 34/79: Color comments and strings inside defuns., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 4b25191 28/79: Refactor benchmarks. Improve benchmark reliability., Jackson Ray Hamilton, 2015/06/13
- [elpa] master f3697c0 35/79: Strings are sexps., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 87893df 32/79: Support comma splicing., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 7167e93 19/79: Pass let and let* tests with recursive colorizer., Jackson Ray Hamilton, 2015/06/13
- [elpa] master af4f773 33/79: Colorize comments and strings inside backquotes., Jackson Ray Hamilton, 2015/06/13
- [elpa] master acaaf39 38/79: Add file statistics to benchmarks., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 8836df9 37/79: Add colorization times to logs., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 5661ed0 44/79: Document `:host' and `:port' properties., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 16fa835 40/79: Optimize JSON parser., Jackson Ray Hamilton, 2015/06/13