unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>
To: Dmitry Gutov <dgutov@yandex.ru>,
	Stefan Kangas <stefan@marxist.se>,
	Jakobsson Mattias <mattias.jakobsson@smhi.se>
Cc: 45717@debbugs.gnu.org
Subject: bug#45717: 27.1; Error with apostrophe in JSX comment
Date: Fri, 19 Nov 2021 18:32:06 -0800	[thread overview]
Message-ID: <154a42d8-0822-0896-2b02-499026c20346@jacksonrayhamilton.com> (raw)
In-Reply-To: <92d3cf8f-22e9-0f82-3d6f-36cc6dfbfb56@yandex.ru>

Hi, thanks for bringing this to our attention.

This code seems to throw js-jsx--syntax-propertize-extend-region into an 
infinite loop.  M-x toggle-debug-on-error and M-x eval-expression 
(js-jsx--syntax-propertize-extend-region 69 240) shows the stack trace; 
(backward-sexp) ultimately causes (syntax-propertize), thus the loop.

Using M-x edebug-defun to debug js-jsx--syntax-propertize-extend-region, 
after pressing space a bunch of times to step through it, I see it’s 
trying to jump from “)}” to the “{” in “className={”.  The presence of 
the apostrophe somehow interrupts the intended logic.

I tried adding parse-sexp-ignore-comments to the let and it suppressed 
the infinite loop but caused a scan-error (which is immediately caught) 
which seems wrong to me.

I tried adding (parse-sexp-ignore-comments t) to the let and encountered 
another infinite loop.

Tricky.  For now, I’ll leave the mailing list with my notes.

On 11/2/21 6:34 PM, Dmitry Gutov wrote:
> On 31.10.2021 05:41, Stefan Kangas wrote:
>> tags 45717 + confirmed
>> thanks
>>
>> Jakobsson Mattias<mattias.jakobsson@smhi.se>  writes:
>>
>>> I get the errors in the Recent messages further below if I edit 
>>> (e.g., by inserting a newline)
>>> a JSX file with the content between the ``` below. If I remove the 
>>> apostrophe from
>>> "don't" in the comment the errors goes away.
>>>
>>> ```
>>> import React from "react";
>>>
>>> const MyComponent = ({ someList }) => (
>>>    <div
>>>      className={someList.filter(
>>>        // don't include an apostrophe in this comment
>>>        (cls) => cls !== "someclass"
>>>      )}
>>>    />
>>> );
>>>
>>> export default MyComponent;
>>> ```
>> I tried reproducing this on current master, but I don't see any message.
>> However, I do see incorrect highlighting after the comment with the
>> apostrophe, so something is clearly still not working as it should.
>
> I do see errors in this scenario, especially after trying to edit or 
> move around. Like:
>
> js-jsx--syntax-propertize-extend-region: Lisp nesting exceeds 
> ‘max-lisp-eval-depth’Error during redisplay: (jit-lock-function 1) 
> signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
>
> Adding Jackson to Cc, perhaps he'll have time and inclination to 
> investigate this.





      reply	other threads:[~2021-11-20  2:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 16:26 bug#45717: 27.1; Error with apostrophe in JSX comment Jakobsson Mattias
2021-10-31  2:41 ` Stefan Kangas
2021-11-03  1:34   ` Dmitry Gutov
2021-11-20  2:32     ` Jackson Ray Hamilton [this message]

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=154a42d8-0822-0896-2b02-499026c20346@jacksonrayhamilton.com \
    --to=jackson@jacksonrayhamilton.com \
    --cc=45717@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=mattias.jakobsson@smhi.se \
    --cc=stefan@marxist.se \
    /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).