]> code.delx.au - gnu-emacs-elpa/blobdiff - README.md
Improve documentation
[gnu-emacs-elpa] / README.md
index beecc925107e2a88cb70dfa6a1b63425557f593c..d17a283a32e84ff98d833c3c08ea5ea441d75466 100644 (file)
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Install
 
     $ git clone git://github.com/mooz/js2-mode.git
     $ cd js2-mode
-    $ emacs --batch --eval '(byte-compile-file "js2-mode.el")'
+    $ emacs --batch -f batch-byte-compile js2-mode.el
 
 Then, place js2-mode.elc into your site-lisp directory.
 
@@ -48,8 +48,8 @@ When js2-consistent-level-indent-inner-bracket-p is nil
                        return validate(v);
                    });
 
-Fixed ugly indentation with multi-line variable declaration
------------------------------------------------------------
+Pretty multi-line variable declaration
+--------------------------------------
 
 In original js2-mode.el,
 
@@ -57,7 +57,7 @@ In original js2-mode.el,
     bar = 20,
     baz = 30;
 
-In this js2-mode.el,
+In this js2-mode.el, when the value `js2-use-ast-for-indentation-p` is non-nil (default nil),
 
     var foo = 10,
         bar = 20,
@@ -114,7 +114,7 @@ Proper position for functions in nested object literals:
         bar: function() {}, // ok in original
         baz: {
              boop: function() {} // fixed here
-        },
+        }
     }
 
 Imenu support for function nesting
@@ -143,6 +143,33 @@ Examples of output:
 
 No support for library-specific extension methods like _.extend.
 
+Highlights undeclared/external variables
+----------------------------------------
+
+Original mode highlights them only on the left side of assignments:
+
+    var house;
+    hose = new House(); // highlights "hose"
+
+Here they are highlighted in all expressions:
+    
+    function feed(fishes, food) {
+        for each (var fish in fshes) { // highlights "fshes"
+            food.feed(fsh); // highlights "fsh"
+        }
+        hood.discard(); // highlights "hood"
+    }
+
+Destructuring assignments and array comprehensions (JS 1.7) are supported:
+
+    let three, [one, two] = [1, 2];
+    thee = one + two; // highlights "thee" 
+
+    function revenue(goods) {
+        // highlights "coast"
+        return [price - coast for each ({price, cost} in goods)].reduce(add);
+    }
+    
 Bugs
 ====