GNU bug report logs -
#20915
25.0.50; [js-mode] electric annoyances
Previous Next
Full log
View this message in rfc822 format
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
This bug report was last modified 10 years and 44 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.