[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4bbce56 38/47: Add test for interruption.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 4bbce56 38/47: Add test for interruption. |
Date: |
Mon, 18 May 2015 09:52:04 +0000 |
branch: master
commit 4bbce5681327381e34a745a364c45650c0b43e27
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Add test for interruption.
---
context-coloring.el | 18 ++++++++++++++----
test/context-coloring-test.el | 26 ++++++++++++++++++++++++--
test/fixtures/{depth.el => iteration.el} | 0
3 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 585f325..b8407a5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -438,6 +438,7 @@ provide visually \"instant\" updates at ~60 frames per
second.")
(inhibit-point-motion-hooks t)
(iteration-count 0)
(last-fontified-position (point))
+ beginning-of-current-defun
end-of-current-defun
(end (point-max))
(last-ppss-pos (point))
@@ -485,13 +486,22 @@ provide visually \"instant\" updates at ~60 frames per
second.")
;; Fontify until the end of the current defun because doing it in
;; chunks based soley on point could result in partial
;; re-fontifications over the contents of scopes.
- (setq end-of-current-defun (save-excursion
- (end-of-defun)
- (point)))
+ (save-excursion
+ (end-of-defun)
+ (setq end-of-current-defun (point))
+ (beginning-of-defun)
+ (setq beginning-of-current-defun (point)))
+
;; Fontify in chunks.
(context-coloring-maybe-colorize-comments-and-strings
last-fontified-position
- end-of-current-defun)
+ (cond
+ ;; We weren't actually in a defun, so don't color the next one,
as
+ ;; that could result in `font-lock' properties being added to it.
+ ((> beginning-of-current-defun (point))
+ (point))
+ (t
+ end-of-current-defun)))
(setq last-fontified-position (point))
(when (and context-coloring-parse-interruptable-p
(input-pending-p))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 7466e23..19f844b 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -236,6 +236,9 @@ environment."
(defun context-coloring-test-assert-position-string (position)
(context-coloring-test-assert-position-face position 'font-lock-string-face))
+(defun context-coloring-test-assert-position-nil (position)
+ (context-coloring-test-assert-position-face position nil))
+
(defun context-coloring-test-assert-coloring (map)
"Assert that the current buffer's coloring matches MAP."
;; Omit the superfluous, formatting-related leading newline. Can't use
@@ -268,6 +271,10 @@ environment."
((= char 99)
(context-coloring-test-assert-position-constant-comment (point))
(forward-char))
+ ;; 'n' = nil
+ ((= char 110)
+ (context-coloring-test-assert-position-nil (point))
+ (forward-char))
;; 's' = String
((= char 115)
(context-coloring-test-assert-position-string (point))
@@ -1171,13 +1178,28 @@ see that function."
2222 1 1 2 2 2 000022
1111 1 1 1 0 0 000011")))
-(context-coloring-test-deftest-emacs-lisp-mode depth
+(defun context-coloring-test-insert-unread-space ()
+ (setq unread-command-events (cons '(t . 32)
+ unread-command-events)))
+
+(defun context-coloring-test-remove-faces ()
+ (remove-text-properties (point-min) (point-max) '(face nil)))
+
+(context-coloring-test-deftest-emacs-lisp-mode iteration
(lambda ()
(let ((context-coloring-emacs-lisp-iterations-per-pause 1))
(context-coloring-colorize)
(context-coloring-test-assert-coloring "
;; `cc' `cc'
-(xxxxx x ())")))
+(xxxxx x ())")
+ (context-coloring-test-remove-faces)
+ (context-coloring-test-insert-unread-space)
+ (context-coloring-colorize)
+ ;; The first iteration will color the first part of the comment, but
+ ;; that's it. Then it will be interrupted.
+ (context-coloring-test-assert-coloring "
+;; nnnn nnnn
+nnnnnn n nnn")))
:setup (lambda ()
(setq context-coloring-syntactic-comments t)
(setq context-coloring-syntactic-strings t)))
diff --git a/test/fixtures/depth.el b/test/fixtures/iteration.el
similarity index 100%
rename from test/fixtures/depth.el
rename to test/fixtures/iteration.el
- [elpa] master d24de46 31/47: Add TODO., (continued)
- [elpa] master d24de46 31/47: Add TODO., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 07c5852 30/47: Add idle change teardown function., Jackson Ray Hamilton, 2015/05/18
- [elpa] master ef544ef 29/47: Fontify keywords., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 5c5b429 32/47: Fix font-lock error., Jackson Ray Hamilton, 2015/05/18
- [elpa] master c0a6689 33/47: Only set defaults when the mode is enabled., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 59a6c8e 34/47: Fix timer disposal and timer buffer detection., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 88a921f 35/47: Improve defun regexp., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 438cb33 36/47: Fix incorrect last fontified position., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 1d7761c 37/47: Add constant comment test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 4ff6e82 39/47: Remove verbose parsing., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 4bbce56 38/47: Add test for interruption.,
Jackson Ray Hamilton <=
- [elpa] master 6392d1f 40/47: Bind optional parameters earlier., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 5051a70 42/47: Update documentation for emacs lisp., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 6a4ad31 43/47: Add derived mode support., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 3b6a391 44/47: Minor cleanup., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 708276e 41/47: Compiler micro-optimizations., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 3bf805d 46/47: Version 6.3.0., Jackson Ray Hamilton, 2015/05/18
- [elpa] master c6e173b 45/47: Merge branch 'elisp', Jackson Ray Hamilton, 2015/05/18
- [elpa] master b525e2d 47/47: Merge commit '3bf805df83fe6f110f3e7e8ce2dc37e0cf6c14cb' from context-coloring, Jackson Ray Hamilton, 2015/05/18