Subject: Re: bug#40563: 28.0.50; Narrow to defun in python buffer

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 26 Oct 2020 14:57:15 +0100

Tomas Nordin <[email-masked]> writes:

> I then noticed that placing point just below the class definition and
> then narrow works as expected. But I think the recipe way should work as
> well. And even if not, this behavior is confusing.

This bug is still present on the trunk.

The problem is most easily reproduced by calling the

  (python-nav--beginning-of-defun)

function directly.  If point is on the first line, then this function
won't do the right thing:

def a1(self):
    pass

Because it starts off checking whether it is, indeed, on the first line
before trying to get to the start of the first line in the function.

This seems like such a basic problem that I wondered whether it's a
newly introduced bug, but it's been there for...  at least a decade,
apparently?

Doesn't anybody use python-mode?

It looks easy enough to fix, but I'm just wondering whether there's
something obvious here I'm not seeing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no