emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 48471e9: Don't mistake certain JS method calls fo


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 48471e9: Don't mistake certain JS method calls for keywords
Date: Tue, 01 Dec 2015 03:41:22 +0000

branch: emacs-25
commit 48471e9614c5a0d1cf63a4604970a45931092230
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Don't mistake certain JS method calls for keywords
    
    * lisp/progmodes/js.el (js--ctrl-statement-indentation):
    Braceless keyword can't come after a period (bug#22063).
---
 lisp/progmodes/js.el |    1 +
 test/indent/js.js    |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 356a31d..310b7ba 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1823,6 +1823,7 @@ nil."
                    (skip-syntax-backward " ")
                    (skip-syntax-backward "w_")
                    (looking-at js--possibly-braceless-keyword-re))
+                 (memq (char-before) '(?\s ?\t ?\n ?\}))
                  (not (js--end-of-do-while-loop-p))))
       (save-excursion
         (goto-char (match-beginning 0))
diff --git a/test/indent/js.js b/test/indent/js.js
index d897b9f..9a1e0dc 100644
--- a/test/indent/js.js
+++ b/test/indent/js.js
@@ -76,6 +76,20 @@ class A {
   }
 }
 
+if (true)
+  1
+else
+  2
+
+Foobar
+  .find()
+  .catch((err) => {
+    return 2;
+  })
+  .then((num) => {
+    console.log(num);
+  });
+
 // Local Variables:
 // indent-tabs-mode: nil
 // js-indent-level: 2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]