GNU bug report logs - #40760
27.0.50; An indentation problem with const and chaining in js-mode

Previous Next

Package: emacs;

Reported by: Marcin Borkowski <mbork <at> mbork.pl>

Date: Wed, 22 Apr 2020 09:06:01 UTC

Severity: normal

Found in version 27.0.50

Full log


Message #25 received at 40760 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Marcin Borkowski <mbork <at> mbork.pl>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 40760 <at> debbugs.gnu.org
Subject: Re: bug#40760: 27.0.50; An indentation problem with const and
 chaining in js-mode
Date: Wed, 23 Mar 2022 02:46:45 +0200
On 21.03.2022 08:26, Marcin Borkowski wrote:

> Interesting - I thought using spaces for indentation is a no-no nowadays
> (at least in JS, Lisp is another thing, for obvious reasons).  But I may
> be mistaken, and I don't think tabs are inherently better - though we do
> use them in our company.

There are a bunch of odd styles in use in JS. For example, comma-first 
indentation, where you don't put commas at the end of a line, and 
instead add newline and indentation before them.

But space-based indentation still seems prevalent.

Anyway...

>> This indentation feature was ported from js2-mode at some point, where
>> it is guarded by the (on by default) user option
>> js2-pretty-multiline-declarations. The option itself was lost in
>> transition.
>>
>> See js2-old-indent.el for more info.
> 
> Very interesting.  FWIW, I almost never have many variables in a single
> let/const - I prefer to write
> 
> let a = 1;
> let b = 2;
> const c = 3;
> const d = 4;
> 
> (and this also is a style I learned where I work).

At some point support for multi-var combined declarations was requested 
for, that's when I added that var.

So, the code is out there, it shouldn't be hard to adapt to js-mode, if 
you have the time.




This bug report was last modified 3 years and 67 days ago.

Previous Next


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