]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/context-coloring/README.md
Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' from context-coloring
[gnu-emacs-elpa] / packages / context-coloring / README.md
index 7eeacf7564ba8855a79619162d29843d05264fc3..6c895de91619765240608069594b515113fa1a4b 100644 (file)
@@ -1,32 +1,15 @@
-# Context Coloring [![Build Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=develop)](https://travis-ci.org/jacksonrayhamilton/context-coloring)
+# Context Coloring [![Build Status](https://travis-ci.org/jacksonrayhamilton/context-coloring.png?branch=master)](https://travis-ci.org/jacksonrayhamilton/context-coloring) [![Coverage Status](https://coveralls.io/repos/jacksonrayhamilton/context-coloring/badge.svg?branch=master)](https://coveralls.io/r/jacksonrayhamilton/context-coloring?branch=master)
 
 <p align="center">
   <img alt="Screenshot of JavaScript code highlighted by context." src="screenshot.png" title="Screenshot">
 </p>
 
-Highlights code according to function context.
+Highlights code by scope.  Top-level scopes are one color, second-level scopes
+are another color, and so on.  Variables retain the color of the scope in which
+they are defined.  A variable defined in an outer scope referenced by an inner
+scope is colored the same as the outer scope.
 
-- Code in the global scope is one color. Code in functions within the global
-  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 are declared.
-
-Lexical scope information at-a-glance can assist a programmer in understanding
-the overall structure of a program. It can help to curb nasty bugs like name
-shadowing. A rainbow can indicate excessive complexity. State change within a
-closure is easily monitored.
-
-By default, context-coloring still highlights comments and strings
-syntactically. It is still easy to differentiate code from non-code, and strings
-cannot be confused for variables.
-
-This coloring strategy is probably more useful than conventional syntax
-highlighting. Highlighting keywords can help one to detect spelling errors, but
-a [linter][] could also spot those errors, and if integrated with [flycheck][],
-an extra spot opens up in your editing toolbelt.
-
-Give context-coloring a try; you may find that it *changes the way you write
-code*.
+By default, comments and strings are still highlighted syntactically.
 
 ## Features
 
@@ -61,7 +44,7 @@ cd context-coloring/
 make compile
 ```
 
-- Add the following to your `~/.emacs` file:
+- Add the following to your init file:
 
 ```lisp
 (add-to-list 'load-path "~/.emacs.d/context-coloring")
@@ -76,7 +59,7 @@ npm install -g scopifier
 
 ## Usage
 
-Add the following to your `~/.emacs` file:
+Add the following to your init file:
 
 ```lisp
 ;; non-js2-mode users:
@@ -104,7 +87,7 @@ Add the following to your `~/.emacs` file:
 ### Color Schemes
 
 Color schemes for custom themes are automatically applied when those themes are
-active. Built-in theme support is available for: `ample`, `anti-zenburn`,
+active.  Built-in theme support is available for: `ample`, `anti-zenburn`,
 `grandshell`, `leuven`, `monokai`, `solarized`, `spacegray`, `tango` and
 `zenburn`.
 
@@ -131,30 +114,30 @@ See `C-h f context-coloring-define-theme` for more info on theme parameters.
 ## Extending
 
 To add support for a new language, write a "scopifier" for it, and define a new
-coloring dispatch strategy with `context-coloring-define-dispatch`. Then the
-plugin should handle the rest. (See `C-h f context-coloring-define-dispatch` for
-more info on dispatch strategies.)
+coloring dispatch strategy with `context-coloring-define-dispatch`.  Then the
+plugin should handle the rest.  (See `C-h f context-coloring-define-dispatch`
+for more info on dispatch strategies.)
 
 A "scopifier" is a CLI program that reads a buffer's contents from stdin and
-writes a JSON array of numbers to stdout. Every three numbers in the array
-represent a range of color. For instance, if I fed the following string of
-JavaScript code to a scopifier:
+writes a JSON array of numbers to stdout.  Every three numbers in the array
+represent a range of color.  For instance, if I fed the following string of
+JavaScript code to a scopifier
 
 ```js
 var a = function () {};
 ```
 
-Then the scopifier would produce the following array:
+then the scopifier would produce the following array
 
 ```js
 [1,24,0,9,23,1]
 ```
 
-Where, for every three numbers, the first number is a 1-indexed start [point][],
+where, for every three numbers, the first number is a 1-indexed start [point][],
 the second number is an exclusive end point, and the third number is a scope
-level. The result of applying level 0 coloring to the range &#91;1, 24) and then
-applying level 1 coloring to the range &#91;9, 23) would result in the following
-coloring:
+level.  The result of applying level 0 coloring to the range &#91;1, 24) and
+then applying level 1 coloring to the range &#91;9, 23) would result in the
+following coloring:
 
 <p align="center">
   <img alt="Screenshot of ranges &#91;1, 24) and &#91;9, 23)." src="scopifier.png" title="Screenshot">
@@ -184,11 +167,9 @@ print scopifier ARGF.read
 ```
 
 When a `--version` argument is passed, a scopifier should print its version
-number and exit. This allows context-coloring to determine if an update is
+number and exit.  This allows context-coloring to determine if an update is
 required.
 
-[linter]: http://jshint.com/about/
-[flycheck]: http://www.flycheck.org/
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier