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

To reply to this bug, email your comments to 41676 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41676; Package emacs. (Tue, 02 Jun 2020 22:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Brian Leung <bkleung89 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 02 Jun 2020 22:07:01 GMT) Full text and rfc822 format available.

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)]

Forcibly Merged 28448 41676. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 08 May 2022 12:39:02 GMT) Full text and rfc822 format available.

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.