如何让js-mode正确缩进continue(复合?)var声明?

Che*_*eso 9 javascript emacs

如果我使用不同的var语句,如

function stretchDiv(){
    var wh = $(window).height();
    var sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + 2) * 2);
    // the scrollbar happens only when the height of the elt is constrained
    var sz3 = sz2 - outTop - 2;
    $('#out').css({'height': sz3 + 'px'});
}
Run Code Online (Sandbox Code Playgroud)

然后JSLint抱怨,告诉我将第二个和第三个与前一个结合起来.

在此输入图像描述

如果我遵循这个建议,JSLint很高兴,但是Emacs的内置js-mode.el(Emacs v23.2)并没有var按照我想要的方式缩进附加声明.此外,它不会对其他变量执行字体锁定.看到:

function stretchDiv(){
    var wh = $(window).height(),
    sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + 2) * 2),
    // the scrollbar happens only when the height of the elt is constrained
    sz3 = sz2 - outTop - 2;
    $('#out').css({'height': sz3 + 'px'});
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何获得正确的缩进和字体锁定?

yib*_*ibe 9

的JS2型分叉版本不正是你想要的.