13

There are a couple JavaScript modes out there:

Does anyone have a recommendation on which to use?


EDIT
2011 June 11 - This is sort of an old, outdated question at this point. FYI: Emacs v23 now includes a javascript mode, it's called js-mode and it is basically a renamed and updated espresso mode. I've chosen to use the built-in mode.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • 1
    I've been using a [js2-mode fork](https://github.com/mooz/js2-mode) that has decent community backing/support in fixing things. The fixes made me switch back to js2-mode using, instead of js-mode. – Brian Nov 15 '11 at 01:02

2 Answers2

17

There's also espresso-mode.

A note from the espresso-mode homepage:

Espresso has been incorporated into GNU Emacs starting with version 23.2 and has been renamed js-mode.
Ville Laurikari
  • 28,380
  • 7
  • 60
  • 55
jlf
  • 3,461
  • 2
  • 18
  • 14
  • 1
    +1 espresso-mode is much better for navigating around functions (`C-M-a` and `C-M-e`) than js2-mode. The author also actively responds to issue requests unlike js2-mode – seth Jul 30 '09 at 19:52
  • Good to know. I was ready to pull the trigger on js2-mode but now I have to rethink it. – Cheeso Jul 31 '09 at 04:38
  • js-mode (formerly expresso) doesn't handle etags very well, even when used with exuberant-ctags. It chokes on namespaced functions. e.g. typing ```M-.``` on ```this.myFunction()``` would look for ```.myFunction``` instead of ```myFunction```. It also would only look at files open in other buffers instead of everything indexed in TAGS. Check out mooz's community fork of js2-mode, which is actively maintained. https://github.com/mooz/js2-mode/ – Andrew De Andrade Jan 19 '12 at 07:33
6

I use js2-mode for JavaScript authoring, and it's excellent. It's not ideal for JavaScript-like languages, though (ActionScript), so it's good to have a simple mode around as a backup for those cases.

Derek Slager
  • 13,619
  • 3
  • 34
  • 34
  • So JavaScript is not "JavaScript-like"? Do you mean to say "non-JavaScript languages that are similar to JavaScript"? – Chris Conway Jul 30 '09 at 22:19
  • 3
    Conway, everyone else understood what mr unknown was saying. give him a break. – Cheeso Jul 31 '09 at 04:39
  • 2
    js2-mode already included into GNU Emacs tree, and will released as part of GNU Emacs 23.2 – Alex Ott Jul 31 '09 at 06:58
  • 3
    @Alex, you mean espresso-mode. The js2-mode (by Steve Yegge) is _not_ being included into Emacs. They included espresso-mode, and renamed it js-mode. – Ville Laurikari Sep 21 '10 at 11:07