[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master dc2f9a6 25/47: Refactor maybe-colorize-comments-and-string
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master dc2f9a6 25/47: Refactor maybe-colorize-comments-and-strings. |
Date: |
Mon, 18 May 2015 09:51:54 +0000 |
branch: master
commit dc2f9a6e3b43e7559b9d2325031bdd79542e9cf1
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Refactor maybe-colorize-comments-and-strings.
---
context-coloring.el | 30 +++++++++++++-----------------
1 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 940b90d..22097a5 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -172,29 +172,25 @@ the END point (exclusive) with the face corresponding to
LEVEL."
"Tell `font-lock' to color a string but not a comment."
(if (nth 3 state) font-lock-string-face nil))
-(defsubst context-coloring-maybe-colorize-comments-and-strings ()
+(defsubst context-coloring-maybe-colorize-comments-and-strings (&optional min
max)
"Color the current buffer's comments and strings if
`context-coloring-comments-and-strings' is non-nil."
(when (or context-coloring-comments-and-strings
context-coloring-syntactic-comments
context-coloring-syntactic-strings)
- (let ((old-function font-lock-syntactic-face-function)
- saved-function-p)
- (cond
- ((and context-coloring-syntactic-comments
- (not context-coloring-syntactic-strings))
- (setq font-lock-syntactic-face-function
- 'context-coloring-font-lock-syntactic-comment-function)
- (setq saved-function-p t))
- ((and context-coloring-syntactic-strings
- (not context-coloring-syntactic-comments))
- (setq font-lock-syntactic-face-function
- 'context-coloring-font-lock-syntactic-string-function)
- (setq saved-function-p t)))
+ (let ((font-lock-syntactic-face-function
+ (cond
+ ((and context-coloring-syntactic-comments
+ (not context-coloring-syntactic-strings))
+ 'context-coloring-font-lock-syntactic-comment-function)
+ ((and context-coloring-syntactic-strings
+ (not context-coloring-syntactic-comments))
+ 'context-coloring-font-lock-syntactic-string-function)
+ (t
+ font-lock-syntactic-face-function))))
(save-excursion
- (font-lock-fontify-syntactically-region (point-min) (point-max)))
- (when saved-function-p
- (setq font-lock-syntactic-face-function old-function)))))
+ (font-lock-fontify-syntactically-region (or min (point-min))
+ (or max (point-max)))))))
;;; js2-mode colorization
- [elpa] master b4072c1 14/47: Trivial refactoring for clarity., (continued)
- [elpa] master b4072c1 14/47: Trivial refactoring for clarity., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 926d74a 17/47: Include binding order in let* test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 29328af 18/47: Add let test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master ea3ff31 16/47: Pass let* test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master b28e896 19/47: Add complex nesting to let test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master bd9c147 20/47: Ignore the dot., Jackson Ray Hamilton, 2015/05/18
- [elpa] master d7b2c92 21/47: Remove unused functions., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 0836b9f 22/47: Add change hooks for elisp., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 08bf3e4 23/47: Ignore question marks., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 09ec36e 24/47: Add interruption mechanism., Jackson Ray Hamilton, 2015/05/18
- [elpa] master dc2f9a6 25/47: Refactor maybe-colorize-comments-and-strings.,
Jackson Ray Hamilton <=
- [elpa] master a556195 26/47: Tweak iteration values, add logging., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 3fc5b20 27/47: Make dispatches fully redefinable., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 89f20e4 28/47: Improve interruptability of syntactic coloring., Jackson Ray Hamilton, 2015/05/18
- [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