GNU bug report logs -
#22063
25.0.50; js-mode, incorrect indentation of functions with keyword names
Previous Next
Reported by: Jordon Biondo <jordon.biondo <at> appropos.com>
Date: Mon, 30 Nov 2015 19:50:02 UTC
Severity: normal
Found in version 25.0.50
Fixed in version 25.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22063 in the body.
You can then email your comments to 22063 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22063
; Package
emacs
.
(Mon, 30 Nov 2015 19:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jordon Biondo <jordon.biondo <at> appropos.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 30 Nov 2015 19:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
js-mode will incorrectly indent chained function calls when the function
shares a name with a keyword. This is particularly problematic when
writing js code using the ES6 Promise API which contains a `catch`
function.
The following example contains the correct, desired indentation:
Foobar
.find()
.then((foo) => {
return 1;
})
.catch((err) => {
return 2;
})
.then((num) => {
console.log(num);
});
The following example shows how Emacs currently indents the above code:
Foobar
.find()
.then((foo) => {
return 1;
})
.catch((err) => {
return 2;
})
.then((num) => {
console.log(num);
});
This is caused by the function being named `catch` which the current
indentation support falsely assumes is the catch keyword. If you were to
change the code from `.catch` to `.catch2` it would indent correctly.
This problem is not limited to only the `catch` keyword.
In GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.4.0, NS appkit-1348.17 Version 10.10.4 (Build 14E46))
of 2015-07-14 on Jordons-MacBook-Pro.local
Repository revision: 894a90671b9ebc37fb56abfcef6e422e954d6460
Configured using:
`configure --prefix=/usr/local/Cellar/emacs/HEAD
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs --without-dbus
--without-gnutls --with-ns --disable-ns-self-contained'
Configured features:
ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Javascript
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-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 messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit [2 times]
Mark set
Making completion list... [3 times]
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message dired 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 help-fns mail-prsvr mail-utils js advice json imenu thingatpt
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs term/xterm xterm byte-opt gv bytecomp byte-compile
cl-extra help-mode easymenu seq cl-loaddefs pcase cl-lib cconv time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel ns-win term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote cocoa ns multi-tty
make-network-process emacs)
Memory information:
((conses 16 111616 7362)
(symbols 48 21847 0)
(miscs 40 83 155)
(strings 32 22480 4769)
(string-bytes 1 758400)
(vectors 16 12850)
(vector-slots 8 399482 2718)
(floats 8 130 402)
(intervals 56 233 0)
(buffers 976 14))
Reply sent
to
Dmitry Gutov <dgutov <at> yandex.ru>
:
You have taken responsibility.
(Tue, 01 Dec 2015 03:44:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jordon Biondo <jordon.biondo <at> appropos.com>
:
bug acknowledged by developer.
(Tue, 01 Dec 2015 03:44:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 22063-done <at> debbugs.gnu.org (full text, mbox):
Version: 25.1
On 11/30/2015 09:00 PM, Jordon Biondo wrote:
> This is caused by the function being named `catch` which the current
> indentation support falsely assumes is the catch keyword. If you were to
> change the code from `.catch` to `.catch2` it would indent correctly.
> This problem is not limited to only the `catch` keyword.
Thanks for the report; should be fixed now in emacs-25 with 48471e9.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 29 Dec 2015 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 178 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.