Subject: bug#41649: closed (Re: bug#41649: 27.0.91; beginning-of-defun doesn't work inside React markup in js-jsx-mode)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 07 Jun 2020 15:24:01 +0000

Your bug report

#41649: 27.0.91; beginning-of-defun doesn't work inside React markup in js-jsx-mode

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
41649: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41649
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#41649: 27.0.91; beginning-of-defun doesn't work inside React markup in js-jsx-mode
From: Alan Mackenzie <[email-masked]>
To: Brian Leung <[email-masked]>
Cc: [email-masked], Dmitry Gutov <[email-masked]>
Date: Sun, 7 Jun 2020 15:23:20 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello, Brian and Dmitry.

On Thu, Jun 04, 2020 at 09:40:34 -0700, Brian Leung wrote:
> It works for me also. Thanks.

> On Thu, Jun 4, 2020 at 9:26 AM Dmitry Gutov <[email-masked]> wrote:

> > On 04.06.2020 19:23, Alan Mackenzie wrote:
> > > Would you please try out the following patch, which ought to fix the
> > > problem the patch should fix.

> > I tried it a few days ago, and it indeed seemed to fix the reported
> > scenario.

OK, that's good, thanks.

Thinking about it, and considering how many js-mode settings get amended
by this patch, it is fairly complicated.  So, it really is too late for
the emacs-27 branch.  So I've committed the patch to master.

I'm closing the bug with this post.

-- 
Alan Mackenzie (Nuremberg, Germany).

Subject: 27.0.91; beginning-of-defun doesn't work inside React markup in js-jsx-mode
From: Brian Leung <[email-masked]>
To: [email-masked]
Date: Mon, 1 Jun 2020 10:59:50 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

With a file App.js that looks like:

import * as React from "react";
import { render } from "react-dom";

const App = () => {
  return (
    <div>
      <h1 id="abc">hello</h1>
      <SearchParams />
    </div>
  );
};

render(<App />, document.getElementById("root"));

If you open the file in JS mode (Emacs 27), and move point inside of
"abc", calling

M-: (c-beginning-of-defun)

gives the following error:

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  copy-hash-table(nil)
  c-forward-<>-arglist(nil)
  c-backward-<>-arglist(nil nil)
  c-looking-at-decl-block(99 nil)
  c-most-enclosing-decl-block((117 99 88 (40 . 50)))
  c-widen-to-enclosing-decl-scope((117 99 88 (40 . 50)) 1 234)
  c-beginning-of-defun()
  eval((c-beginning-of-defun) t)
  eval-expression((c-beginning-of-defun) nil nil 127)
  funcall-interactively(eval-expression (c-beginning-of-defun) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Manually invoking C-M-a inside the double quotes should end the same way.

In GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: NixOS 20.09 (Nightingale)