[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20915: 25.0.50; [js-mode] electric annoyances
From: |
Rasmus |
Subject: |
bug#20915: 25.0.50; [js-mode] electric annoyances |
Date: |
Sun, 28 Jun 2015 13:46:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hi,
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);
};
Which IMO looks bad for an inline, anonymous function which should just be
inlined.
If electric indentation mode is on, the following characters are bound by
default.
(mapcar 'char-to-string electric-indent-chars)
=> ("{" "}" "(" ")" ":" ";" "," " ")
I think that might be a bit too many.... Consider if I'm using my own
indentation style (e.g. chain syntax as used with d3.js), my manual
indentation is is ruined when I type in basically any function.
Consider:
var plot = {}; var plot.scale = {};
plot.scale.y = d3.scale.ordinal()
.domain(bar.ybins)
.rangeRoundBands([plot.height, 0], 0.1);
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);
I don't know if it is even possible for electric indent mode to somehow
guess that things are indented to an unknown style....
Thanks,
Rasmus
In GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.4)
of 2015-06-21 on x200s
Repository revision: 821a3633564f36857968c7fe2b8bb6681a895905
Windowing system distributor `The X.Org Foundation', version 11.0.11702000
Configured using:
`configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --mandir=/usr/share/man
--pdfdir=/usr/share/doc/emacs/pdf --with-sound=alsa --with-x-toolkit=gtk3
--with-xft 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe
-fstack-protector-strong --param=ssp-buffer-size=4'
CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
--
One thing that is clear: it's all down hill from here
- bug#20915: 25.0.50; [js-mode] electric annoyances,
Rasmus <=
- bug#20915: 25.0.50; [js-mode] electric annoyances, Eli Zaretskii, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Rasmus, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Dmitry Gutov, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Eli Zaretskii, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Dmitry Gutov, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Eli Zaretskii, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Dmitry Gutov, 2015/06/28
- bug#20915: 25.0.50; [js-mode] electric annoyances, Eli Zaretskii, 2015/06/28
bug#20915: 25.0.50; [js-mode] electric annoyances, Stefan Monnier, 2015/06/28