Okay, I've prepared a patch for this, based on Dimitriv's work. I've been using this for a while now and haven't run into any problems. The attached patch is against the latest revision in the emacs-23 branch. I can provide a patch for emacs-24 or trunk if that's desirable. Here's the patched version if you'd like to try it out: https://gist.github.com/2849799 And here's one that should work in Emacs 24: https://gist.github.com/2849595 There's still one thing that I'd like to behave differently, but I thought I'd best discuss this first. The patched js.el will indent the following code like this: var foo = 5, bar = function() { }; That's fine. But if a function or an object literal come first, it indents it like this: var bar = function() { }, foo = 5; Which I consider somewhat ugly. I'd like to make it indent as follows: var bar = function() { }, foo = 5; That should only happen for multi var declarations, single declarations should indent just like before: var bar = function() { }; Would that be acceptable? It'll make the code a bit more complicated, but I think it's worth it.