GNU bug report logs - #20915
25.0.50; [js-mode] electric annoyances

Previous Next

Package: emacs;

Reported by: Rasmus <rasmus <at> gmx.us>

Date: Sun, 28 Jun 2015 11:47:02 UTC

Severity: minor

Found in version 25.0.50

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Rasmus <rasmus <at> gmx.us>
Cc: 20915 <at> debbugs.gnu.org
Subject: bug#20915: 25.0.50; [js-mode] electric annoyances
Date: Sun, 28 Jun 2015 21:12:15 -0400
> 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
electric-indent-(local-)mode.


        Stefan




This bug report was last modified 10 years and 45 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.