Reputation: 868
I get the following:
var
a = 5,
b = 6,
c = foo();
/* code continues */
I want:
var
a = 5,
b = 6,
c = foo();
/* OUTDENT, code continues */
I know as per How to get js-mode to properly indent continued (compound?) var declarations? there is some hack for js2-mode which gets it done. I would like to know how to do it with javascript-mode (the built-in one, into emacs 24). "var" should indent one level until the first semicolon after var. Comma-first-style should not alter that.
Ideally, I could have it in my init.el, which I could then sync to every computer I am working on. Is that possible? How do I do it?
Upvotes: 1
Views: 281
Reputation: 3665
Put a = 5
on the same line as var
. Otherwise, there's no mode that supports this.
Use Emacs trunk. The bit of indentation code from js2-mode
that does this has been committed to js-mode
just recently, and it was too late for 24.3
. Alternatively, just use a recently released Emacs, and copy js.el
from the Emacs source tree to a directory in your load-path
.
Upvotes: 1