|
From: | Felix H. Dahlke |
Subject: | bug#8576: 23.2; js-mode doesn't support multi-line variable declarations |
Date: | Fri, 01 Jun 2012 09:30:21 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
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. |
indent-multiline-var-statements.patch
Description: Text Data
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |