GNU bug report logs - #29798
24.3; Javascript: Too much indentation with + and -

Previous Next

Package: emacs;

Reported by: Gavin Haynes <haynes.gt <at> gmail.com>

Date: Thu, 21 Dec 2017 07:58:02 UTC

Severity: wishlist

Tags: confirmed

Found in versions 28.0.50, 24.3

To reply to this bug, email your comments to 29798 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Thu, 21 Dec 2017 07:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gavin Haynes <haynes.gt <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Dec 2017 07:58:02 GMT) Full text and rfc822 format available.

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

From: Gavin Haynes <haynes.gt <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Javascript: Too much indentation with + and -
Date: Wed, 20 Dec 2017 23:53:37 -0800
[Message part 1 (text/plain, inline)]
Please describe exactly what actions triggered the bug, and the precise
symptoms of the bug. If you can, give a recipe starting from `emacs -Q':
Write the following in a .js file: { -2, 2, +2 } Then, put your cursor over
each line and press tab to indent it. The lines having -2 and +2 get twice
as much indentation as expected. The line having just 2 has the correct
indentation. If Emacs crashed, and you have the Emacs process in the gdb
debugger, please include the output from the following gdb commands: `bt
full' and `xbacktrace'. For information about debugging Emacs, please read
the file /usr/share/emacs/24.3/etc/DEBUG. In GNU Emacs 24.3.1
(x86_64-pc-linux-gnu, GTK+ Version 3.10.8) of 2017-09-19 on lcy01-35,
modified by Debian System Description: Ubuntu 14.04.5 LTS Configured using:
`configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LANG:
en_CA.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix
default enable-multibyte-characters: t Major mode: Javascript Minor modes
in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t
menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t
font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t
auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent
input: ESC [ > 1 ; 3 4 0 9 ; 0 c C-n C-n C-e RET - 2 , TAB RET 3 TAB C-x
C-s C-p C-p RET TAB d e l e t e SPC 2 TAB , TAB TAB C-n TAB C-p TAB C-b C-b
C-b C-b C-b C-b C-b DEL TAB C-e C-n RET + 1 , TAB RET ~ 4 TAB , TAB RET ! 0
TAB , TAB C-p C-p C-n C-n RET - 2 TAB DEL DEL DEL DEL C-a C-k C-p C-e ESC x
r e p o r t - e m a c s - b u g RET Recent messages: Loading
/etc/emacs/site-start.d/50erlang-mode.el (source)...done Loading
/etc/emacs/site-start.d/50festival.el (source)...done Loading
/etc/emacs/site-start.d/50gtk-doc-tools.el (source)...done Loading
/etc/emacs/site-start.d/50lilypond-data.el (source)...done Loading
/etc/emacs/site-start.d/50mdk.el (source)...done For information about GNU
Emacs and the GNU system, type C-h C-a. Saving file /tmp/a.js... Wrote
/tmp/a.js Auto-saving...done Auto-saving...done Load-path shadows:
/usr/share/emacs/24.3/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides
/usr/share/emacs/site-lisp/cmake-mode Features: (shadow sort gnus-util
mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils js json
imenu thingatpt cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs time-date byte-opt warnings
bytecomp byte-compile cconv advice help-fns cl-lib advice-preload
tide-autoloads flycheck-autoloads seq-autoloads let-alist-autoloads
pkg-info-autoloads epl-autoloads finder-inf s-autoloads dash-autoloads
typescript-mode-autoloads package erlang-start devhelp tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Thu, 21 Dec 2017 10:46:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Gavin Haynes <haynes.gt <at> gmail.com>, 29798 <at> debbugs.gnu.org
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Thu, 21 Dec 2017 12:45:13 +0200
Hi Gavin,

On 12/21/17 9:53 AM, Gavin Haynes wrote:
> { -2, 2, +2 }

What does this mean in JavaScript? Is this a block with comma-separated 
statements?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Thu, 21 Dec 2017 10:51:01 GMT) Full text and rfc822 format available.

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

From: Gavin Haynes <haynes.gt <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 29798 <at> debbugs.gnu.org
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Thu, 21 Dec 2017 10:50:33 +0000
[Message part 1 (text/plain, inline)]
Perhaps. Anyway, you can get the same behaviour with this code:

console.log(
   -2,
  2
);

On Thu, Dec 21, 2017 at 2:45 AM Dmitry Gutov <dgutov <at> yandex.ru> wrote:

> Hi Gavin,
>
> On 12/21/17 9:53 AM, Gavin Haynes wrote:
> > { -2, 2, +2 }
>
> What does this mean in JavaScript? Is this a block with comma-separated
> statements?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Thu, 21 Dec 2017 11:05:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Gavin Haynes <haynes.gt <at> gmail.com>
Cc: 29798 <at> debbugs.gnu.org
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Thu, 21 Dec 2017 13:04:27 +0200
On 12/21/17 12:50 PM, Gavin Haynes wrote:
> console.log(
>     -2,
>    2
> );

And this example has been fixed since at least Emacs 25.2. Probably earlier.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Mon, 10 Aug 2020 15:33:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Gavin Haynes <haynes.gt <at> gmail.com>
Cc: 29798 <at> debbugs.gnu.org
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Mon, 10 Aug 2020 08:31:59 -0700
found 29798 28.0.50
thanks

Gavin Haynes <haynes.gt <at> gmail.com> writes:

> Write the following in a .js file: { -2, 2, +2 } Then, put your cursor
> over each line and press tab to indent it. The lines having -2 and +2
> get twice as much indentation as expected. The line having just 2 has
> the correct indentation.

I can reproduce this on current master.  I see the following
indentation:

{
-2,
    2,
 +2
}

Best regards,
Stefan Kangas




bug Marked as found in versions 28.0.50. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 10 Aug 2020 15:33:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Mon, 10 Aug 2020 15:37:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Kangas <stefan <at> marxist.se>, Gavin Haynes <haynes.gt <at> gmail.com>
Cc: 29798 <at> debbugs.gnu.org
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Mon, 10 Aug 2020 18:36:08 +0300
On 10.08.2020 18:31, Stefan Kangas wrote:
> I can reproduce this on current master.  I see the following
> indentation:
> 
> {
> -2,
>      2,
>   +2
> }

I don't think that's valid JavaScript either.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Mon, 10 Aug 2020 15:55:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 29798 <at> debbugs.gnu.org, Gavin Haynes <haynes.gt <at> gmail.com>
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Mon, 10 Aug 2020 17:53:43 +0200
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> > I can reproduce this on current master.  I see the following
> > indentation:
> >
> > {
> > -2,
> >      2,
> >   +2
> > }
>
> I don't think that's valid JavaScript either.

In the Firefox web console, I get

{ -2, 2, +2 }  =>  2

So I guess it's valid, if a bit nonsensical? I must admit that my
knowledge of JavaScript is terrible though.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Mon, 10 Aug 2020 17:18:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 29798 <at> debbugs.gnu.org, Gavin Haynes <haynes.gt <at> gmail.com>
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Mon, 10 Aug 2020 20:17:16 +0300
On 10.08.2020 18:53, Stefan Kangas wrote:
> In the Firefox web console, I get
> 
> { -2, 2, +2 }  =>  2

Yeah, it seems like it's interpreted like a comma-separated list of 
statements in a block.

> So I guess it's valid, if a bit nonsensical? I must admit that my
> knowledge of JavaScript is terrible though.

We generally prioritize supporting code that is likely to actually be 
written by somebody, so IMHO there is no significant bug here.

But if someone would like to propose a patch, we will surely review it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Mon, 10 Aug 2020 17:24:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 29798 <at> debbugs.gnu.org, Gavin Haynes <haynes.gt <at> gmail.com>
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Mon, 10 Aug 2020 19:22:46 +0200
severity 29798 wishlist
thanks

Dmitry Gutov <dgutov <at> yandex.ru> writes:

> We generally prioritize supporting code that is likely to actually be
> written by somebody, so IMHO there is no significant bug here.
>
> But if someone would like to propose a patch, we will surely review it.

Agreed.  So I'm changing the severity to wishlist.  But please feel
free to close it if you think that's better.

Best regards,
Stefan Kangas




Severity set to 'wishlist' from 'minor' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 10 Aug 2020 17:24:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29798; Package emacs. (Thu, 03 Feb 2022 19:37:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 29798 <at> debbugs.gnu.org, Gavin Haynes <haynes.gt <at> gmail.com>
Subject: Re: bug#29798: 24.3; Javascript: Too much indentation with + and -
Date: Thu, 03 Feb 2022 20:36:45 +0100
Stefan Kangas <stefan <at> marxist.se> writes:

> I can reproduce this on current master.  I see the following
> indentation:
>
> {
> -2,
>     2,
>  +2
> }

This nonsensical form has changed indentation in Emacs 29, apparently:

{
    -2,
  2,
  +2
}



-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 03 Feb 2022 19:38:01 GMT) Full text and rfc822 format available.

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

Previous Next


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