Getting start with js2-mode in Emacs

The js2-mode is a javascript mode that actually works.


Get the latest js2, put it in your load-path, the configuration

(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(setq js2-basic-offset 2)
(setq js2-use-font-lock-faces t)


  • Indenting that works! Finally.
  • Syntax highlighting that works.
  • Inline warnings and syntax errors.
  • Code folding that works.