emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master cae3b72 240/271: Document new dispatch API.


From: Jackson Ray Hamilton
Subject: [elpa] master cae3b72 240/271: Document new dispatch API.
Date: Thu, 05 Feb 2015 18:31:35 +0000

branch: master
commit cae3b72dedf16449220a026eb140d0ccbb580889
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Document new dispatch API.
---
 README.md |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 14f4f1a..af1be13 100644
--- a/README.md
+++ b/README.md
@@ -91,8 +91,9 @@ theme used in the screenshot above).
 
 ## Extending
 
-To add support for a new language, write a "scopifier" for it, and add an entry
-to `context-coloring-dispatch-plist`. Then the plugin should handle the rest.
+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.
 
 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
@@ -123,6 +124,24 @@ If there is an abstract syntax tree generator for your 
language, you can walk
 the syntax tree, find variables and scopes, and build their positions and 
levels
 into an array like the one above.
 
+For example, a Ruby scopifier might be defined and implemented like this:
+
+```lisp
+(context-coloring-define-dispatch 'ruby
+  :modes '(ruby-mode)
+  :executable "ruby"
+  :command "/home/username/scopifier")
+```
+
+```ruby
+#!/usr/bin/env ruby
+def scopifier(code)
+    # Parse code.
+    # Return an array.
+end
+print scopifier ARGF.read
+```
+
 [linter]: http://jshint.com/about/
 [flycheck]: http://www.flycheck.org/
 [zenburn]: http://github.com/bbatsov/zenburn-emacs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]