[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8576: 23.2; js-mode doesn't support multi-line variable declarations

From: Dmitry Gutov
Subject: bug#8576: 23.2; js-mode doesn't support multi-line variable declarations
Date: Tue, 17 Jul 2012 09:00:14 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

"Felix H. Dahlke" <address@hidden> writes:

> On 07/17/2012 06:21 AM, Dmitry Gutov wrote:
> I've updated the gists and attached a new patch.

I'm sorry, I spoke too soon. Now I see that your patch relies on the
value of `js-indent-level' being 4. And what if the keyword is "const"?
Unless you're fine with the following indentation, the patch I posted
earlier is better:

const a = 5,
    b = 6;

>>> The only solution I can think of would be to go back up after
>>> typing a closing brace followed by a comma and indent the
>>> preceeding lines.
>>> Some modes do that, but it would require drastic changes to js.el.
>>> I'd rather get this patch in first and see if the issue annoys me
>>> (or anyone else) enough to work further on this.
>> I don't think this will be much of a problem.
> Probably not, but I fear it's going to be a lot of work - at least
> when I do it.

I meant that nobody will care, most likely. But the implementation
shouldn't be too hard either - add a function to `post-command-hook'
which would check if the command is `self-insert-command', check if we
inserted a comma, skip backward to the previous non-whitespace char, see
if it's } or ], etc.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]