From WikEmacs
Jump to: navigation, search

JavaScript is supported out of the box in Emacs, see js-mode.

javascript modes[edit]


js-mode is the default javascript mode for emacs. See js-mode.


js2-mode by Steve Yegge is one of the most complete JavaScript modes. It boasts run-time validation of JavaScript.

Tern, the "intelligent javascript tooling"[edit]

Tern is a stand-alone code-analysis engine for JavaScript. It is intended to be used with a code editor plugin, such as Emacs, to enhance the editor's support for intelligent JavaScript editing. Features provided are:

  • Autocompletion on variables and properties
  • Function argument hints
  • Querying the type of an expression
  • Finding the definition of something
  • Automatic refactoring

To see what Tern is all about, you should try the online demo !

Tern is open-source (MIT license), written in JavaScript, and capable of running both on node.js and in the browser.

See the installation instructions for Emacs' Tern mode .

AngularJS integration[edit]

imenu integration[edit]


Tern integration[edit]


and a company backend:

Highlighting Angular directives in templates[edit]


JavaScript REPL[edit]

Have a look at mozrepl - a REPL for interacting with an external web browser's internal JavaScript engine. However MozRepl seems to be unmaintained. There is swank-js which is browser independent and based on Node.JS and SLIME.

See also[edit]

The following packages are available on MELPA.


You can use flymake-jslint or flymake-gjslint to lint your javascript code.

Run javascript in an inferior process window[edit]

js-comint.el let's you run an inferior javascript process in emacs, and defines a few functions for sending javascript input to it quickly.

Live browser eval of JavaScript every time a buffer changes[edit]

This can be accomplished with skewer-mode or livid-mode.

Beautify HTML, CSS and JavaScript/JSON[edit]

This will be done with web-beautify.