there are a million options, I'm only going to talk about how I edit
Which Mode do I Use?
I use js2-mode. It provides
syntax highlighting and underlines errors as you type. This mode
doesn't come with emacs, it was built by Steve Yegge. However it is
installable through the ELPA.
One problem I found with this mode is that it has some weird ideas
about indentation. I personally prefer the indentation from the
built-in js-mode in emacs. After some googling I came across a
on fixing indentation in js2-mode. Starting with that I then made my
own modifications and have a js2-mode that works exactly the way I
want it (code below).
In my experience I'm not always editing pure .js files. Sometimes
haml-mode I am using is supposed to have easy js-mode integration.
However I tried to integrate js2-mode, and it was not simple.
regular basis. Troubleshooting that problem looked like it was going
to take more time than I had. Instead I wrote some elisp to allow me
I'm happy with the code. It's a very simple solution to the problem.
It creates a buffer named scratch-js with js2-mode. It's not unlike
the elisp scratch buffer that comes up on emacs start up. I don't
This is admittedly a stopgap solution. I would prefer to have
js2-mode integrated tightly with haml-mode. If anyone else has
actually done this, I would love to see the code.