X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/e950f4a0bc51f6e79c5f1bc101949a3d3bc326bb..58857dc01d4de5196f39f02afd12151ac4d0d349:/README.md diff --git a/README.md b/README.md index 4d7b235f8..cbce9c37c 100644 --- a/README.md +++ b/README.md @@ -1,149 +1,55 @@ -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 . +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 --eval '(byte-compile-file "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/) +(M-x list-packages). -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 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 -======================================== - -Supported more 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); - }); - -Fixed ugly indentation with multi-line variable declaration ------------------------------------------------------------ - -In original js2-mode.el, - - var foo = 10, - bar = 20, - baz = 30; - -In this js2-mode.el, - - var foo = 10, - bar = 20, - baz = 30; - -Support for 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); - -Support for expression closure in property value ------------------------------------------------- - - let worker = { - get age() 20, - get sex() "male", - fire: function () _fire() - }; - -Fixed 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 ----------------------------------- +Bugs +==== -Supports one level of nesting: +* See broken syntax highlighting and timer errors? Recently upgraded +Emacs from version 24.2 or earlier? - function foo() { - function bar() { // shown as foo.bar - function baz() {} // hidden - } - } +* Try +[reinstalling or byte-recompiling](https://github.com/mooz/js2-mode/issues/72) +the package. -Top-level function can be anonymous wrapper: +Please report problems at . - (function() { - var foo = function() {}; // shown as foo - })(); +Contributing +====== -Examples of output: +`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/). -* [Underscore.js](https://github.com/documentcloud/underscore/blob/master/underscore.js) --> -* [Backbone.js](https://github.com/documentcloud/backbone/blob/master/backbone.js) --> +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. -No support for library-specific extension methods like _.extend. +See Also +====== -Bugs -==== +Some third-party modes that use the generated syntax tree: -If you find problems, please report them to . +* [js2-refactor](https://github.com/magnars/js2-refactor.el) +* [skewer-mode](https://github.com/skeeto/skewer-mode)