JavaScript: Emacs

Steve Yegge’s Javascript Mode

“An improved Java Script mode for GNU Emacs.”

packaged mode

https://github.com/mooz/js2-mode
Installable from package

original mode

blog announcement

I’m useing Yegge’s mode, and it works pretty well. Sometimes chokes on syntax highlighting, and has some quirks (insists on semicolons in places where they aren’t needed; maybe I should check up on that). The indentation system is weird. I know he wrote a lot about how hard it is to do right -- but why do other modes seem to do it, then? Anyway. works.

better indentation and SVN version

1. checkout the version from the SVN
2. make it
1. if you don’t have cygwin or linux,
2. cd \path\to\js2-mode-read-only
3. emacs -batch -q -l js2-build.el -f js2-build-j2-mode
4. copy the files where they need to go
5. (taken from Makefile

IT WORKED. finally fixed the crappy indentation.

Indentation

ASSUMING YOU ARE USING js2mode

change auto-indent level
you can do this via custom, and change it everywhere
or in .emacs -- and change it everywhere
or via (setq js2-basic-offset 2) and change it just for that local buffer
Which may be the solution for now.