From xradiograph

JavaScript: Emacs





Steve Yegge’s Javascript Mode

“An improved Java Script mode for GNU Emacs.”




packaged mode
Installable from package



original mode

JS2-mode homepage (google-code)
blog announcement


compile issues with Emacs23



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
  3. follow the other directions


IT WORKED. finally fixed the crappy indentation.







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.





my own weird codes

Javascript functions
GreaseMonkey functions



See Also




JavaScript IDE Emacs greasemonkey

Retrieved from
Page last modified on January 07, 2014, at 09:39 AM