Subject: bug#24854: 25.1; indent error with regexp

From: Dmitry Gutov <[email-masked]>
Date: Tue, 15 Nov 2016 02:04:45 +0200

On 02.11.2016 01:30, James Yang wrote:

> var re = /some value/
>
>  str.match(re)
>
>
> 4. You can see line 2 will have indent, which should not.
>
>
> I also report it to this url: https://github.com/mooz/js2-mode/issues/382

Thanks for the report. The patch is attached.

Eli, would you allow this for 25.2? It's not a regression, but the fix 
is simple.

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index f024d39..6d995a0 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1757,6 +1757,10 @@ js--looking-at-operator-p
                (and (js--re-search-backward "[?:{]\\|\\_<case\\_>" nil t)
                     (eq (char-after) ??))))
          (not (and
+               (eq (char-after) ?/)
+               (save-excursion
+                 (eq (nth 3 (syntax-ppss)) ?/))))
+         (not (and
                (eq (char-after) ?*)
                ;; Generator method (possibly using computed property).
                (looking-at (concat "\\* *\\(?:\\[\\|" js--name-re " *(\\)"))
diff --git a/test/indent/js.js b/test/indent/js.js
index b40d47b..806e949 100644
--- a/test/indent/js.js
+++ b/test/indent/js.js
@@ -69,6 +69,9 @@ a++
 b +=
   c
 
+var re = /some value/
+str.match(re)
+
 baz(`http://foo.bar/${tee}`)
   .qux();