[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bc0cb0d 16/79: Pass lambda test with recursive colorizer.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master bc0cb0d 16/79: Pass lambda test with recursive colorizer. |
Date: |
Sun, 14 Jun 2015 00:05:20 +0000 |
branch: master
commit bc0cb0de7a47ed3b5210d11f738e1850575bb580
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Pass lambda test with recursive colorizer.
---
context-coloring.el | 56 ++++++++++++++++++++++++++--------------
test/context-coloring-test.el | 12 ++++----
2 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 6aa2bbf..8972da9 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -477,13 +477,14 @@ provide visually \"instant\" updates at 60 frames per
second.")
(t
0))))
-(defun context-coloring-elisp-colorize-defun ()
+(defun context-coloring-elisp-colorize-defun (&optional anonymous-p)
(let ((start (point))
end
+ stop
syntax
syntax-code
- child-1-pos
- child-1-end
+ defun-name-pos
+ defun-name-end
arg-n-pos
arg-n-end
arg-n-string)
@@ -491,24 +492,37 @@ provide visually \"instant\" updates at 60 frames per
second.")
;; Color the whole sexp.
(forward-sexp)
(setq end (point))
- (context-coloring-colorize-region start end 1)
+ (context-coloring-colorize-region
+ start
+ end
+ (context-coloring-elisp-current-scope-level))
(goto-char start)
;; Skip past the "defun".
(skip-syntax-forward "^w_")
(forward-sexp)
(skip-syntax-forward " ")
- ;; Check for the defun's name.
- (setq syntax (syntax-after (point)))
- (setq syntax-code (syntax-class syntax))
+ (setq stop nil)
+ (unless anonymous-p
+ ;; Check for the defun's name.
+ (setq syntax (syntax-after (point)))
+ (setq syntax-code (syntax-class syntax))
+ (cond
+ ((or (= syntax-code context-coloring-WORD-CODE)
+ (= syntax-code context-coloring-SYMBOL-CODE))
+ ;; Color the defun's name with the top-level color.
+ (setq defun-name-pos (point))
+ (forward-sexp)
+ (setq defun-name-end (point))
+ (context-coloring-colorize-region defun-name-pos defun-name-end 0)
+ (skip-syntax-forward " "))
+ (t
+ (setq stop t))))
(cond
- ((or (= syntax-code context-coloring-WORD-CODE)
- (= syntax-code context-coloring-SYMBOL-CODE))
- ;; Color the defun's name with the top-level color.
- (setq child-1-pos (point))
- (forward-sexp)
- (setq child-1-end (point))
- (context-coloring-colorize-region child-1-pos child-1-end 0)
- (skip-syntax-forward " ")
+ (stop
+ ;; Skip it.
+ (goto-char start)
+ (forward-sexp))
+ (t
(setq syntax (syntax-after (point)))
(setq syntax-code (syntax-class syntax))
(cond
@@ -545,13 +559,12 @@ provide visually \"instant\" updates at 60 frames per
second.")
(t
;; Skip it.
(goto-char start)
- (forward-sexp))))
- (t
- ;; Skip it.
- (goto-char start)
- (forward-sexp)))
+ (forward-sexp)))))
(context-coloring-elisp-pop-scope)))
+(defun context-coloring-elisp-colorize-lambda ()
+ (context-coloring-elisp-colorize-defun t))
+
(defun context-coloring-elisp-colorize-sexp ()
(let ((start (point))
end
@@ -581,6 +594,9 @@ provide visually \"instant\" updates at 60 frames per
second.")
((string-match-p context-coloring-emacs-lisp-defun-regexp
child-0-string)
(goto-char start)
(context-coloring-elisp-colorize-defun))
+ ((string-match-p context-coloring-emacs-lisp-lambda-regexp
child-0-string)
+ (goto-char start)
+ (context-coloring-elisp-colorize-lambda))
;; Not a special form; just colorize the remaining region.
(t
(context-coloring-colorize-region
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index da6a8be..4b8a939 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1086,12 +1086,12 @@ ssssssssssss0"))
111111 01
111111 111")))
-;; (context-coloring-test-deftest-emacs-lisp lambda
-;; (lambda ()
-;; (context-coloring-test-assert-coloring "
-;; 00000000 1111111 1111
-;; 11111111 11 2222222 2222
-;; 222 22 12 2221 111 0 00")))
+(context-coloring-test-deftest-emacs-lisp lambda
+ (lambda ()
+ (context-coloring-test-assert-coloring "
+00000000 1111111 1111
+ 11111111 11 2222222 2222
+ 222 22 12 2221 111 0 00")))
;; (context-coloring-test-deftest-emacs-lisp quote
;; (lambda ()
- [elpa] master c1b6b52 06/79: Update function scopes and global tests., (continued)
- [elpa] master c1b6b52 06/79: Update function scopes and global tests., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 5e0a0d9 10/79: Newlines., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 23cf7b3 09/79: Refactor derived mode tests., Jackson Ray Hamilton, 2015/06/13
- [elpa] master fd2f2d0 08/79: Refactor remaining js tests., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 1f474d9 11/79: Reorganize functions., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 92166ba 13/79: Add no-fixture option., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 8ea8c9c 15/79: Pass defun test with recursive colorizer., Jackson Ray Hamilton, 2015/06/13
- [elpa] master ea6b4ef 14/79: Increase test documentation., Jackson Ray Hamilton, 2015/06/13
- [elpa] master 7975003 18/79: Pass ignored test with recursive colorizer., Jackson Ray Hamilton, 2015/06/13
- [elpa] master d8b5f03 12/79: Remove before-all and after-all., Jackson Ray Hamilton, 2015/06/13
- [elpa] master bc0cb0d 16/79: Pass lambda test with recursive colorizer.,
Jackson Ray Hamilton <=
- [elpa] master 6090eb3 17/79: Pass quote test with recursive colorizer., Jackson Ray Hamilton, 2015/06/13
- [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