[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 79513b2 109/271: Remove styling from faces.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 79513b2 109/271: Remove styling from faces. |
Date: |
Thu, 05 Feb 2015 18:30:20 +0000 |
branch: master
commit 79513b20a0e04f2ffb59ce7595cba10d4d285cfa
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Remove styling from faces.
---
README.md | 3 +-
bin/cli.js | 2 +-
context-coloring.el | 59 ++++++--------------------------------------------
scopifier.js | 23 ++++++-------------
4 files changed, 16 insertions(+), 71 deletions(-)
diff --git a/README.md b/README.md
index b476f41..2c28844 100644
--- a/README.md
+++ b/README.md
@@ -10,8 +10,7 @@ Highlights JavaScript code according to function context.
scope is a different color, and code within such functions is another color,
and so on.
- Identifiers retain the color of the scope in which they were declared.
-- Identifiers are bold when first declared.
-- Comments are gray and italic.
+- Comments are gray.
JavaScript programmers often leverage closures to bind nearby data to
functions. Lexical scope information at-a-glance can assist a programmer in
diff --git a/bin/cli.js b/bin/cli.js
index 3453b33..1a059bc 100644
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -1,6 +1,6 @@
// Reads a JavaScript file from stdin.
-// Writes an array of `[start, end, level, style]' tokens to stdout.
+// Writes an array of tokens to stdout.
'use strict';
diff --git a/context-coloring.el b/context-coloring.el
index b32ab35..9f21dfc 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -92,46 +92,6 @@
"Context coloring face, depth 6."
:group 'context-coloring-faces)
-(defface context-coloring-depth--1-italic-face
- '((default (:inherit context-coloring-depth--1-face :slant italic)))
- "Context coloring face, depth -1; italic; comments."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-0-bold-face
- '((default (:inherit context-coloring-depth-0-face :weight bold)))
- "Context coloring face, depth 0; bold; global scope."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-1-bold-face
- '((default (:inherit context-coloring-depth-1-face :weight bold)))
- "Context coloring face, depth 1; bold."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-2-bold-face
- '((default (:inherit context-coloring-depth-2-face :weight bold)))
- "Context coloring face, depth 2; bold."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-3-bold-face
- '((default (:inherit context-coloring-depth-3-face :weight bold)))
- "Context coloring face, depth 3; bold."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-4-bold-face
- '((default (:inherit context-coloring-depth-4-face :weight bold)))
- "Context coloring face, depth 4; bold."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-5-bold-face
- '((default (:inherit context-coloring-depth-5-face :weight bold)))
- "Context coloring face, depth 5; bold."
- :group 'context-coloring-faces)
-
-(defface context-coloring-depth-6-bold-face
- '((default (:inherit context-coloring-depth-6-face :weight bold)))
- "Context coloring face, depth 6; bold."
- :group 'context-coloring-faces)
-
(defconst context-coloring-face-count 7
"Number of faces defined for highlighting delimiter levels.
Determines depth at which to cycle through faces again.")
@@ -139,8 +99,8 @@ Determines depth at which to cycle through faces again.")
;;; Face functions
-(defsubst context-coloring-level-face (depth style)
- "Return face-name for DEPTH and STYLE as a string
\"context-coloring-depth-DEPTH-face\".
+(defsubst context-coloring-level-face (depth)
+ "Return face-name for DEPTH as a string
\"context-coloring-depth-DEPTH-face\".
For example: \"context-coloring-depth-1-face\"."
(intern-soft
(concat "context-coloring-depth-"
@@ -154,9 +114,6 @@ For example: \"context-coloring-depth-1-face\"."
(+ 1
(mod (- depth 1)
(- context-coloring-face-count 1)))))
- (cond ((= 1 style) "-bold")
- ((= 2 style) "-italic")
- (t ""))
"-face")))
@@ -210,9 +167,9 @@ imply that it should be colorized again.")
(defun context-coloring-apply-tokens (tokens)
"Processes TOKENS to apply context-based coloring to the
-current buffer. Tokens are 4 integers: start, end, level, and
-style. The array is flat, with a new token occurring after every
-4th number."
+current buffer. Tokens are 3 integers: start, end, level. The
+array is flat, with a new token occurring after every 3rd
+number."
(with-silent-modifications
;; Reset in case there should be uncolored areas.
(remove-text-properties (point-min) (point-max) `(face nil rear-nonsticky
nil))
@@ -222,10 +179,8 @@ style. The array is flat, with a new token occurring after
every
(add-text-properties
(elt tokens i)
(elt tokens (+ i 1))
- `(face ,(context-coloring-level-face
- (elt tokens (+ i 2))
- (elt tokens (+ i 3))) rear-nonsticky t))
- (setq i (+ i 4))))))
+ `(face ,(context-coloring-level-face (elt tokens (+ i 2)))
rear-nonsticky t))
+ (setq i (+ i 3))))))
(defsubst context-coloring-kill-scopifier ()
"Kills the currently-running scopifier process for this
diff --git a/scopifier.js b/scopifier.js
index 8145501..9e7c8ef 100644
--- a/scopifier.js
+++ b/scopifier.js
@@ -1,14 +1,9 @@
'use strict';
var escope = require('./lib/escope'),
- esprima = require('./lib/esprima'),
+ esprima = require('./lib/esprima');
- normal = 0,
- bold = 1,
- italic = 2;
-
-// Given code, returns an array of `[start, end, level, style]' tokens for
-// context-coloring.
+// Given code, returns an array of tokens for context-coloring.
module.exports = function (code) {
var analyzedScopes,
ast,
@@ -65,8 +60,7 @@ module.exports = function (code) {
scopes.push(
range[0] + 1,
range[1] + 1,
- scope.level,
- normal
+ scope.level
);
definitionsIndex = tokens.length;
definitionsCount = 0;
@@ -79,8 +73,7 @@ module.exports = function (code) {
tokens.push(
range[0] + 1,
range[1] + 1,
- scope.level,
- bold
+ scope.level
);
}
}
@@ -93,7 +86,7 @@ module.exports = function (code) {
// declared and initialized simultaneously; this filters
// them.)
for (k = 0; k < definitionsCount; k += 1) {
- pointer = definitionsIndex + (k * 4);
+ pointer = definitionsIndex + (k * 3);
if (tokens[pointer] === range[0] + 1 &&
tokens[pointer + 1] === range[1] + 1) {
isDefined = true;
@@ -105,8 +98,7 @@ module.exports = function (code) {
// Handle global references too.
range[0] + 1,
range[1] + 1,
- reference.resolved ?
reference.resolved.scope.level : 0,
- reference.__maybeImplicitGlobal ? bold : normal
+ reference.resolved ?
reference.resolved.scope.level : 0
);
}
}
@@ -120,8 +112,7 @@ module.exports = function (code) {
tokens.push(
range[0] + 1,
range[1] + 1,
- -1,
- italic
+ -1
);
}
- [elpa] master a321d8b 096/271: Update screenshot., (continued)
- [elpa] master a321d8b 096/271: Update screenshot., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c8a1710 100/271: Add message about needing Node.js., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 53cf944 099/271: Remove make from instructions., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9f39f5c 095/271: More benchmark improvements., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c7d1adf 103/271: Refactor Makefile., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 3cd5c31 101/271: Typos., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 46f0986 105/271: Update readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ab083f4 102/271: Simplify package.json., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 1c47db9 107/271: Fix link., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 0960e18 106/271: Spelling., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 79513b2 109/271: Remove styling from faces.,
Jackson Ray Hamilton <=
- [elpa] master c6ea2eb 116/271: Add degree sign., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d430804 108/271: Add tty faces., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d339677 113/271: Strip BOM., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9693c56 125/271: Move fixture into its own file., Jackson Ray Hamilton, 2015/02/05
- [elpa] master e58833f 120/271: Refactor and document., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 3031e54 119/271: Extend range; fix modulo bug., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d78046d 098/271: Include external libraries., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f7f4fe8 126/271: Improve elisp tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master fe2bd04 128/271: Multiple vars., Jackson Ray Hamilton, 2015/02/05
- [elpa] master b51c36d 118/271: New experimental color scheme., Jackson Ray Hamilton, 2015/02/05