unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36700: 27.0.50; python-mode beginning-of-defun broken
@ 2019-07-16 23:59 Yilin Wei
  2019-07-17  0:49 ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: Yilin Wei @ 2019-07-16 23:59 UTC (permalink / raw)
  To: 36700

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 609 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#36700: 27.0.50; python-mode beginning-of-defun broken
  2019-07-16 23:59 bug#36700: 27.0.50; python-mode beginning-of-defun broken Yilin Wei
@ 2019-07-17  0:49 ` Noam Postavsky
  2020-08-26  0:26   ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2019-07-17  0:49 UTC (permalink / raw)
  To: Yilin Wei; +Cc: 36700

Yilin Wei <yilin.wei10@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.
                       ^^^^^^^^^^^^^^^^^





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#36700: 27.0.50; python-mode beginning-of-defun broken
  2019-07-17  0:49 ` Noam Postavsky
@ 2020-08-26  0:26   ` Stefan Kangas
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2020-08-26  0:26 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Yilin Wei, 36700

tags 36700 + notabug
close 36700
thanks

Noam Postavsky <npostavs@gmail.com> writes:

> Yilin Wei <yilin.wei10@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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-26  0:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-16 23:59 bug#36700: 27.0.50; python-mode beginning-of-defun broken Yilin Wei
2019-07-17  0:49 ` Noam Postavsky
2020-08-26  0:26   ` Stefan Kangas

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