GNU bug report logs - #41676
27.0.91; js-beginning-of-defun doesn't handle ES2015 class and arrow functions

Previous Next

Package: emacs;

Reported by: Brian Leung <bkleung89 <at> gmail.com>

Date: Tue, 2 Jun 2020 22:07:01 UTC

Severity: minor

Merged with 28448

Found in versions 26.0.50, 27.0.91

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brian Leung <bkleung89 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.91;
 js-beginning-of-defun doesn't handle ES2015 class and arrow functions
Date: Tue, 2 Jun 2020 15:05:52 -0700
[Message part 1 (text/plain, inline)]
In the following ES2015 file:

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

class Abc extends React.Component {}

const App = () => {
  return (
    <div>
      <h1 id="5">Hi</h1>
    </div>
  );
};

function abc(x) {
  return 42;
}

const def = () => {
  return 1;
};

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



If you start at the end and use M-: js-beginning-of-defun repeatedly
(necessary since in bug #41469 it's clear that
beginning-of-defun-function is c-beginning-of-defun), point stops at the
ES5 function declaration of abc and then at the imports section,
skipping the arrow functions and the class declaration.

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)
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 42 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.