From: Dmitry Gutov <dgutov@yandex.ru>
To: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [Emacs-diffs] master b01a429: js--re-search-backward-inner: Fix infloop
Date: Fri, 1 Feb 2019 03:27:20 +0300 [thread overview]
Message-ID: <6f4122fb-8dcc-836d-9b80-388d417f8cc2@yandex.ru> (raw)
In-Reply-To: <20190201000224.6638E20B45@vcs0.savannah.gnu.org>
Hi Eli,
Any chance I may backport this to emacs-26?
The bug was reported only recently, but it seems pretty annoying
(infloop during indentation), and the fix is simple.
On 01.02.2019 03:02, Dmitry Gutov wrote:
> branch: master
> commit b01a4295c2f9bb58858880e4e28b05cc8396791c
> Author: Dmitry Gutov <dgutov@yandex.ru>
> Commit: Dmitry Gutov <dgutov@yandex.ru>
>
> js--re-search-backward-inner: Fix infloop
>
> Fix JS indentation infloop reported in
> https://github.com/mooz/js2-mode/issues/513.
>
> * lisp/progmodes/js.el (js--re-search-backward-inner): Account for
> multiline string literals.
> * test/manual/indent/js.js: New test example.
> ---
> lisp/progmodes/js.el | 9 +--------
> test/manual/indent/js.js | 7 +++++++
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
> index e55539c..a94a2fe 100644
> --- a/lisp/progmodes/js.el
> +++ b/lisp/progmodes/js.el
> @@ -785,7 +785,6 @@ macro as normal text."
> (defun js--re-search-backward-inner (regexp &optional bound count)
> "Auxiliary function for `js--re-search-backward'."
> (let ((parse)
> - str-terminator
> (orig-macro-start
> (save-excursion
> (and (js--beginning-of-macro)
> @@ -796,13 +795,7 @@ macro as normal text."
> (save-excursion (backward-char) (looking-at "/[/*]")))
> (forward-char))
> (setq parse (syntax-ppss))
> - (cond ((setq str-terminator (nth 3 parse))
> - (when (eq str-terminator t)
> - (setq str-terminator ?/))
> - (re-search-backward
> - (concat "\\([^\\]\\|^\\)" (string str-terminator))
> - (point-at-bol) t))
> - ((nth 7 parse)
> + (cond ((nth 8 parse)
> (goto-char (nth 8 parse)))
> ((or (nth 4 parse)
> (and (eq (char-before) ?/) (eq (char-after) ?*)))
> diff --git a/test/manual/indent/js.js b/test/manual/indent/js.js
> index b0d8bca..df79098 100644
> --- a/test/manual/indent/js.js
> +++ b/test/manual/indent/js.js
> @@ -144,6 +144,13 @@ bar(
> /abc/
> )
>
> +// No infloop inside js--re-search-backward-inner
> +let b = {
> + a : `
> + //1
> + `
> +}
> +
> // Local Variables:
> // indent-tabs-mode: nil
> // js-indent-level: 2
>
> _______________________________________________
> Emacs-diffs mailing list
> Emacs-diffs@gnu.org
> https://lists.gnu.org/mailman/listinfo/emacs-diffs
>
next parent reply other threads:[~2019-02-01 0:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190201000223.22803.66102@vcs0.savannah.gnu.org>
[not found] ` <20190201000224.6638E20B45@vcs0.savannah.gnu.org>
2019-02-01 0:27 ` Dmitry Gutov [this message]
2019-02-01 7:28 ` [Emacs-diffs] master b01a429: js--re-search-backward-inner: Fix infloop Eli Zaretskii
2019-02-02 0:08 ` Dmitry Gutov
2019-02-02 7:31 ` Eli Zaretskii
2019-02-23 23:43 ` Dmitry Gutov
2019-02-24 3:36 ` Eli Zaretskii
2019-02-26 1:01 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6f4122fb-8dcc-836d-9b80-388d417f8cc2@yandex.ru \
--to=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.