]> code.delx.au - gnu-emacs-elpa/blobdiff - README.md
Parse generator methods better
[gnu-emacs-elpa] / README.md
index 85e7e7b2824cb2c5b3ac332559513413b9cdd573..cbce9c37c376c9499715501f781c5b37c611f7bf 100644 (file)
--- a/README.md
+++ b/README.md
-js2-mode
-========
+About [![Build Status](https://travis-ci.org/mooz/js2-mode.svg?branch=master)](https://travis-ci.org/mooz/js2-mode) [![MELPA](https://melpa.org/packages/js2-mode-badge.svg)](https://melpa.org/#/js2-mode)
+======
 
-An improved JavaScript mode for GNU Emacs. Forked from <http://code.google.com/p/js2-mode/>.
+Improved JavaScript editing mode for GNU Emacs ([description here](http://elpa.gnu.org/packages/js2-mode.html)).
 
-Install
-=======
+For some of the latest changes, see [latest user-visible changes](https://github.com/mooz/js2-mode/wiki/Latest-user-visible-changes).
 
-    $ git clone git://github.com/mooz/js2-mode.git
-    $ cd js2-mode
-    $ emacs --batch -f batch-byte-compile js2-mode.el
+Installation
+======
 
-Then, place js2-mode.elc into your site-lisp directory.
+The stable versions are hosted at [GNU ELPA](http://elpa.gnu.org/)
+(<kbd>M-x list-packages</kbd>).
 
-In you emacs config:
+You can also install the latest development version from
+[MELPA](https://melpa.org/#/getting-started).
 
-    (autoload 'js2-mode "js2-mode" nil t)
-    (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
+Emacs 22 and 23
+===============
 
-See <http://code.google.com/p/js2-mode/wiki/InstallationInstructions> for details.
+This version requires Emacs 24 and `cl-lib` (either built-in or from GNU ELPA above).
+For a backward compatible version, check out the branch
+[emacs23](https://github.com/mooz/js2-mode/tree/emacs23).
 
-Differences between original js2-mode.el
-========================================
-
-Popular indentation style
--------------------------
-
-When `js2-consistent-level-indent-inner-bracket-p` is non-nil
-    
-    [foo, bar, baz].forEach(function (v) {
-        if (validate(v))
-            process(v);
-    });
-    
-    [a, b, c].some(function (v) {
-        return validate(v);
-    });
-
-When `js2-consistent-level-indent-inner-bracket-p` is nil
-(Same as original js2-mode's indentation)
-
-    [foo, bar, baz].forEach(function (v) {
-                                if (validate(v))
-                                    process(v);
-                            });
-    
-    [a, b, c].some(function (v) {
-                       return validate(v);
-                   });
-
-Pretty multi-line variable declaration
---------------------------------------
-
-In original js2-mode.el,
-
-    var foo = 10,
-    bar = 20,
-    baz = 30;
-
-In this js2-mode.el, when the value `js2-pretty-multiline-decl-indentation-p` is non-nil,
-
-    var foo = 10,
-        bar = 20,
-        baz = 30;
-
-Abbreviated destructuring assignments
--------------------------------------
-
-    let {a, b}       = {a: 10, b: 20}; // Abbreviated   (Not supported in original js2-mode.el)
-    let {a: a, b: b} = {a: 10, b: 20}; // Same as above (Supported in original js2-mode.el)
-
-    (function ({responseText}) { /* */ })(xhr); // As the argument of function
-
-    for (let [k, { name, age }] in Iterator(obj)) // nested
-        print(k, name, age);
-
-Expression closure in property value
-------------------------------------
-
-    let worker = {
-        get age() 20,
-        get sex() "male",
-        fire: function () _fire()
-    };
-
-Fix for odd indentation of "else if" with no braces
----------------------------------------------------
-
-In original js2-mode.el,
-
-    if (foo)
-        return foo;
-    else if (bar)
-    return bar;      // here
-
-In this js2-mode.el,
-
-    if (foo)
-        return foo;
-    else if (bar)
-        return bar;  // fixed
-
-Fixes in Imenu support
-----------------------
-
-Supports element-get form:
-
-    foo["bar"] = function() {};
-    foo[647] = function() {};
-
-Proper position for functions in nested object literals:
-
-    foo = {
-        bar: function() {}, // ok in original
-        baz: {
-             boop: function() {} // fixed here
-        }
-    }
-
-Imenu support for function nesting
-----------------------------------
-
-Supports one level of nesting:
-
-    function foo() {
-        function bar() { // shown as foo.bar
-            function baz() {} // hidden
-        }
-    }
-
-Top-level function can be anonymous wrapper:
-
-    (function() {
-        var foo = function() {}; // shown as foo
-    })();
-
-Examples of output:
-
-* [Underscore.js](https://github.com/documentcloud/underscore/blob/master/underscore.js)
--> <https://gist.github.com/824262>
-* [Backbone.js](https://github.com/documentcloud/backbone/blob/master/backbone.js)
--> <https://gist.github.com/824260>
+Bugs
+====
 
-No support for library-specific extension methods like _.extend.
+* See broken syntax highlighting and timer errors? Recently upgraded
+Emacs from version 24.2 or earlier?
 
-Highlights undeclared/external variables
-----------------------------------------
+* Try
+[reinstalling or byte-recompiling](https://github.com/mooz/js2-mode/issues/72)
+the package.
 
-Original mode highlights them only on the left side of assignments:
+Please report problems at <http://github.com/mooz/js2-mode/issues>.
 
-    var house;
-    hose = new House(); // highlights "hose"
+Contributing
+======
 
-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"
-    }
+`js2-mode` is subject to the same
+[copyright assignment](http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html)
+policy as Emacs itself, `org-mode`, `CEDET` and other packages in
+[GNU ELPA](http://elpa.gnu.org/packages/).
 
-Destructuring assignments and array comprehensions (JS 1.7) are supported:
+Any
+[legally significant](http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant)
+contributions can only be accepted after the author has completed their
+paperwork. Please ask for the request form, and we'll send it to you.
 
-    let three, [one, two] = [1, 2];
-    thee = one + two; // highlights "thee" 
+See Also
+======
 
-    function revenue(goods) {
-        // highlights "coast"
-        return [price - coast for each ({price, cost} in goods)].reduce(add);
-    }
-    
-Bugs
-====
+Some third-party modes that use the generated syntax tree:
 
-If you find problems, please report them to <http://github.com/mooz/js2-mode/issues>.
+* [js2-refactor](https://github.com/magnars/js2-refactor.el)
+* [skewer-mode](https://github.com/skeeto/skewer-mode)