unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20915: 25.0.50; [js-mode] electric annoyances
@ 2015-06-28 11:46 Rasmus
  2015-06-28 14:41 ` Eli Zaretskii
  2015-06-29  1:12 ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: Rasmus @ 2015-06-28 11:46 UTC (permalink / raw)
  To: 20915

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 





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-06-30 14:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-28 11:46 bug#20915: 25.0.50; [js-mode] electric annoyances Rasmus
2015-06-28 14:41 ` Eli Zaretskii
2015-06-28 14:50   ` Rasmus
2015-06-28 14:56     ` Eli Zaretskii
2015-06-28 17:50   ` Dmitry Gutov
2015-06-28 17:59     ` Eli Zaretskii
2015-06-28 18:12       ` Dmitry Gutov
2015-06-28 18:24         ` Eli Zaretskii
2015-06-28 18:54           ` Dmitry Gutov
2015-06-28 20:16             ` Eli Zaretskii
2015-06-29  1:12 ` Stefan Monnier
2015-06-29  1:26   ` Rasmus
2015-06-29  8:49     ` Dmitry Gutov
2015-06-29 11:02       ` Rasmus
2015-06-29  8:33   ` Dmitry Gutov
2015-06-29 13:18     ` Stefan Monnier
2015-06-29 14:05       ` Dmitry Gutov
2015-06-30 14:07         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).