[Top][All Lists]

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

bug#20915: 25.0.50; [js-mode] electric annoyances

From: Stefan Monnier
Subject: bug#20915: 25.0.50; [js-mode] electric annoyances
Date: Sun, 28 Jun 2015 21:12:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> Electric layout doesn't always quite work to my liking in js-mode.
> Start with Emacs -q and try the following example.
>       x.map(function(d) {return f(x);});
> When electric layout mode is on this is typed as
>      x.map(function(d){
>          return f(d);
>      };

I can't think of any way Emacs could guess that you want to keep this as
a single line.  Any idea?

> Typing the *third line*, I get something like (with electric indent and
> electric layout):
> plot.scale.y = d3.scale.ordinal()
>                        .domain(bar.ybins)
>     .rangeRoundBands([plot.height, 0
>                    ], 0.1);

electric-indent-mode presumes indentation works correctly.  In this
case, I think we clearly have an indentation bug (can someone imagine
a sane programmer who'd want the above indentation?), so the thing to do
is to fix the indentation code.

> I don't know if it is even possible for electric indent mode to somehow
> guess that things are indented to an unknown style....

I can't imagine how.  You can tell Emacs, tho, by disabling


reply via email to

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