]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/context-coloring/README.md
Merge commit '294b5117b42d2622f4fb0a1da219d45d98566b6e' from context-coloring
[gnu-emacs-elpa] / packages / context-coloring / README.md
index 6c895de91619765240608069594b515113fa1a4b..6e8865f240a3e56ec6b169fd708b1e6e89b0a547 100644 (file)
@@ -13,13 +13,19 @@ By default, comments and strings are still highlighted syntactically.
 
 ## Features
 
-- Supported languages: JavaScript
 - Light and dark (customizable) color schemes.
-- Very fast for files under 1000 lines.
+- JavaScript support:
+  - Script, function and block scopes (and even `catch` block scopes).
+  - Very fast for files under 1000 lines.
+- Emacs Lisp support:
+  - `defun`, `lambda`, `let`, `let*`, `cond`, `condition-case`, `defadvice`,
+    `dolist`, `quote`, `backquote` and backquote splicing.
+  - Instantaneous lazy coloring, 8000 lines-per-second full coloring.
+  - Works in `eval-expression` too.
 
 ## Installation
 
-Requires Emacs 24+.
+Requires Emacs 24.3+.
 
 JavaScript language support requires either [js2-mode][], or
 [Node.js 0.10+][node] and the [scopifier][] executable.
@@ -51,7 +57,7 @@ make compile
 (require 'context-coloring)
 ```
 
-### scopifier (for non-js2-mode users)
+### Dependencies (js-mode)
 
 ```bash
 npm install -g scopifier
@@ -62,12 +68,18 @@ npm install -g scopifier
 Add the following to your init file:
 
 ```lisp
-;; non-js2-mode users:
-(add-hook 'js-mode-hook 'context-coloring-mode)
+;; js-mode:
+(add-hook 'js-mode-hook #'context-coloring-mode)
 
-;; js2-mode users:
+;; js2-mode:
 (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
-(add-hook 'js2-mode-hook 'context-coloring-mode)
+(add-hook 'js2-mode-hook #'context-coloring-mode)
+
+;; emacs-lisp-mode:
+(add-hook 'emacs-lisp-mode-hook #'context-coloring-mode)
+
+;; eval-expression:
+(add-hook 'minibuffer-setup-hook #'context-coloring-mode)
 ```
 
 ## Customizing
@@ -78,8 +90,9 @@ Add the following to your init file:
   comments using `font-lock`.
 - `context-coloring-syntactic-strings` (default: `t`): If non-nil, also color
   strings using `font-lock`.
-- `context-coloring-delay` (default: `0.25`; supported modes: `js-mode`,
-  `js3-mode`): Delay between a buffer update and colorization.
+- `context-coloring-default-delay` (default: `0.25`; supported modes: `js-mode`,
+  `js3-mode`): Default (sometimes overridden) delay between a buffer update and
+  colorization.
 - `context-coloring-js-block-scopes` (default: `nil`; supported modes:
   `js2-mode`): If non-nil, also color block scopes in the scope hierarchy in
   JavaScript.
@@ -96,17 +109,17 @@ You can define your own theme colors too:
 ```lisp
 (context-coloring-define-theme
  'zenburn
- :colors '("#DCDCCC"
-           "#93E0E3"
-           "#BFEBBF"
-           "#F0DFAF"
-           "#DFAF8F"
-           "#CC9393"
-           "#DC8CC3"
-           "#94BFF3"
-           "#9FC59F"
-           "#D0BF8F"
-           "#DCA3A3"))
+ :colors '("#dcdccc"
+           "#93e0e3"
+           "#bfebbf"
+           "#f0dfaf"
+           "#dfaf8f"
+           "#cc9393"
+           "#dc8cc3"
+           "#94bff3"
+           "#9fc59f"
+           "#d0bf8f"
+           "#dca3a3"))
 ```
 
 See `C-h f context-coloring-define-theme` for more info on theme parameters.
@@ -170,6 +183,11 @@ 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
 required.
 
+Alternatively, you could implement a "colorizer" in Emacs Lisp.  A colorizer
+also handles the job of calling `context-coloring-colorize-region` to apply
+colors to a buffer.  A colorizer may have better performance than a scopifier
+when parsing and coloring can be performed in the same pass.
+
 [js2-mode]: https://github.com/mooz/js2-mode
 [node]: http://nodejs.org/download/
 [scopifier]: https://github.com/jacksonrayhamilton/scopifier