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.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#22063: 25.0.50; js-mode, incorrect indentation of functions with keyword names
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 22063 <at> debbugs.gnu.org.
--
22063: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22063
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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.
[Message part 3 (message/rfc822, inline)]
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))
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.