unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: James Yang <jamesyang999@gmail.com>,
	24854@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#24854: 25.1; indent error with regexp
Date: Tue, 15 Nov 2016 02:04:45 +0200	[thread overview]
Message-ID: <f6183ddc-3bef-e73e-5bc9-08e2ffe4cb19@yandex.ru> (raw)
In-Reply-To: <CAFr_UgvkVSZ39bCFrEauu+6bp1=QN_kO8BXxTSNJ0jQivr8qjQ@mail.gmail.com>

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

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.


[-- Attachment #2: js-indent-after-regexp-without-semi.diff --]
[-- Type: text/x-diff, Size: 904 bytes --]

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();
 

  parent reply	other threads:[~2016-11-15  0:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 23:30 bug#24854: 25.1; indent error with regexp James Yang
2016-11-08 10:06 ` Andreas Röhler
2016-11-09  0:35   ` npostavs
2016-11-09  6:37     ` Andreas Röhler
2016-11-15  0:04 ` Dmitry Gutov [this message]
2016-11-16  7:45   ` Andreas Röhler
2016-11-16 16:24     ` Eli Zaretskii
2016-11-16 16:39       ` Andreas Röhler
2016-11-16 16:22   ` Eli Zaretskii
2016-11-17  0:07     ` Dmitry Gutov
2016-11-17  3:41       ` Eli Zaretskii
2016-11-17 11:31         ` Andreas Röhler
2016-11-17 16:08           ` Eli Zaretskii
2016-11-18  0:13         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6183ddc-3bef-e73e-5bc9-08e2ffe4cb19@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=24854@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jamesyang999@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).