GNU bug report logs - #36700
27.0.50; python-mode beginning-of-defun broken

Previous Next

Package: emacs;

Reported by: Yilin Wei <yilin.wei10 <at> gmail.com>

Date: Wed, 17 Jul 2019 00:44:02 UTC

Severity: minor

Tags: notabug

Found in version 27.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36700 in the body.
You can then email your comments to 36700 AT debbugs.gnu.org in the normal way.

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#36700; Package emacs. (Wed, 17 Jul 2019 00:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yilin Wei <yilin.wei10 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 17 Jul 2019 00:44:02 GMT) Full text and rfc822 format available.

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

From: Yilin Wei <yilin.wei10 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; python-mode beginning-of-defun broken
Date: Wed, 17 Jul 2019 00:59:38 +0100
[Message part 1 (text/plain, inline)]
Hi,

The function `beginning-of-defun` seems to be be broken if
there is a nested class definition in the function.

I think this also means that `(thing-at-point 'defun)` isn't working
as expected.

Behaviour:

def moo():
    class Test:
      pass
    <-

When the cursor is at the location marked, running (beginning-of-defun)
makes the cursor go to the wrong location, shown below, instead of to
the beginning of the def.

def moo():
<-   class Test:
       pass

Yilin
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36700; Package emacs. (Wed, 17 Jul 2019 00:50:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Yilin Wei <yilin.wei10 <at> gmail.com>
Cc: 36700 <at> debbugs.gnu.org
Subject: Re: bug#36700: 27.0.50; python-mode beginning-of-defun broken
Date: Tue, 16 Jul 2019 20:49:37 -0400
Yilin Wei <yilin.wei10 <at> gmail.com> writes:

> def moo():
>     class Test:
>       pass
>     <-
>
> When the cursor is at the location marked, running (beginning-of-defun)
> makes the cursor go to the wrong location, shown below, instead of to
> the beginning of the def.
>
> def moo():
> <-   class Test:
>        pass

I don't think this is a bug, python.el just takes a more liberal
interpretation of "defun" that includes class definitions.  See for
example, python-nav-beginning-of-defun-regexp:

    (defvar python-nav-beginning-of-defun-regexp
                                    ^^^^^^^^^^^^
      (python-rx line-start (* space) defun (+ space) (group symbol-name))
      "Regexp matching class or function definition.
                       ^^^^^^^^^^^^^^^^^




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36700; Package emacs. (Wed, 26 Aug 2020 00:27:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Yilin Wei <yilin.wei10 <at> gmail.com>, 36700 <at> debbugs.gnu.org
Subject: Re: bug#36700: 27.0.50; python-mode beginning-of-defun broken
Date: Tue, 25 Aug 2020 17:26:00 -0700
tags 36700 + notabug
close 36700
thanks

Noam Postavsky <npostavs <at> gmail.com> writes:

> Yilin Wei <yilin.wei10 <at> gmail.com> writes:
>
>> def moo():
>>     class Test:
>>       pass
>>     <-
>>
>> When the cursor is at the location marked, running (beginning-of-defun)
>> makes the cursor go to the wrong location, shown below, instead of to
>> the beginning of the def.
>>
>> def moo():
>> <-   class Test:
>>        pass
>
> I don't think this is a bug, python.el just takes a more liberal
> interpretation of "defun" that includes class definitions.  See for
> example, python-nav-beginning-of-defun-regexp:
>
>     (defvar python-nav-beginning-of-defun-regexp
>                                     ^^^^^^^^^^^^
>       (python-rx line-start (* space) defun (+ space) (group symbol-name))
>       "Regexp matching class or function definition.
>                        ^^^^^^^^^^^^^^^^^

I agree with Noam here, and seeing as there has been no further replies
within 1 year, I'm therefore closing this bug report.




Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 26 Aug 2020 00:27:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 36700 <at> debbugs.gnu.org and Yilin Wei <yilin.wei10 <at> gmail.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 26 Aug 2020 00:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Sep 2020 11:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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