unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29798: 24.3; Javascript: Too much indentation with + and -
@ 2017-12-21  7:53 Gavin Haynes
  2017-12-21 10:45 ` Dmitry Gutov
  2020-08-10 15:31 ` Stefan Kangas
  0 siblings, 2 replies; 10+ messages in thread
From: Gavin Haynes @ 2017-12-21  7:53 UTC (permalink / raw)
  To: 29798

[-- Attachment #1: Type: text/plain, Size: 4447 bytes --]

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)

[-- Attachment #2: Type: text/html, Size: 4897 bytes --]

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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2017-12-21  7:53 bug#29798: 24.3; Javascript: Too much indentation with + and - Gavin Haynes
@ 2017-12-21 10:45 ` Dmitry Gutov
  2017-12-21 10:50   ` Gavin Haynes
  2020-08-10 15:31 ` Stefan Kangas
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry Gutov @ 2017-12-21 10:45 UTC (permalink / raw)
  To: Gavin Haynes, 29798

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?





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2017-12-21 10:45 ` Dmitry Gutov
@ 2017-12-21 10:50   ` Gavin Haynes
  2017-12-21 11:04     ` Dmitry Gutov
  0 siblings, 1 reply; 10+ messages in thread
From: Gavin Haynes @ 2017-12-21 10:50 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 29798

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

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@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?
>

[-- Attachment #2: Type: text/html, Size: 708 bytes --]

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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2017-12-21 10:50   ` Gavin Haynes
@ 2017-12-21 11:04     ` Dmitry Gutov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Gutov @ 2017-12-21 11:04 UTC (permalink / raw)
  To: Gavin Haynes; +Cc: 29798

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.





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2017-12-21  7:53 bug#29798: 24.3; Javascript: Too much indentation with + and - Gavin Haynes
  2017-12-21 10:45 ` Dmitry Gutov
@ 2020-08-10 15:31 ` Stefan Kangas
  2020-08-10 15:36   ` Dmitry Gutov
  2022-02-03 19:36   ` Lars Ingebrigtsen
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Kangas @ 2020-08-10 15:31 UTC (permalink / raw)
  To: Gavin Haynes; +Cc: 29798

found 29798 28.0.50
thanks

Gavin Haynes <haynes.gt@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





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2020-08-10 15:31 ` Stefan Kangas
@ 2020-08-10 15:36   ` Dmitry Gutov
  2020-08-10 15:53     ` Stefan Kangas
  2022-02-03 19:36   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry Gutov @ 2020-08-10 15:36 UTC (permalink / raw)
  To: Stefan Kangas, Gavin Haynes; +Cc: 29798

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.





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2020-08-10 15:36   ` Dmitry Gutov
@ 2020-08-10 15:53     ` Stefan Kangas
  2020-08-10 17:17       ` Dmitry Gutov
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2020-08-10 15:53 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 29798, Gavin Haynes

Dmitry Gutov <dgutov@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





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2020-08-10 15:53     ` Stefan Kangas
@ 2020-08-10 17:17       ` Dmitry Gutov
  2020-08-10 17:22         ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Gutov @ 2020-08-10 17:17 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 29798, Gavin Haynes

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.





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2020-08-10 17:17       ` Dmitry Gutov
@ 2020-08-10 17:22         ` Stefan Kangas
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2020-08-10 17:22 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 29798, Gavin Haynes

severity 29798 wishlist
thanks

Dmitry Gutov <dgutov@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





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

* bug#29798: 24.3; Javascript: Too much indentation with + and -
  2020-08-10 15:31 ` Stefan Kangas
  2020-08-10 15:36   ` Dmitry Gutov
@ 2022-02-03 19:36   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-03 19:36 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 29798, Gavin Haynes

Stefan Kangas <stefan@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





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

end of thread, other threads:[~2022-02-03 19:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-21  7:53 bug#29798: 24.3; Javascript: Too much indentation with + and - Gavin Haynes
2017-12-21 10:45 ` Dmitry Gutov
2017-12-21 10:50   ` Gavin Haynes
2017-12-21 11:04     ` Dmitry Gutov
2020-08-10 15:31 ` Stefan Kangas
2020-08-10 15:36   ` Dmitry Gutov
2020-08-10 15:53     ` Stefan Kangas
2020-08-10 17:17       ` Dmitry Gutov
2020-08-10 17:22         ` Stefan Kangas
2022-02-03 19:36   ` Lars Ingebrigtsen

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).