Hello Lars Ingebrigtsen writes: > Tomas Nordin 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 Attached is a patch that fix the problems described in this report. The change of variable name 'beg-indentation' to 'body-indentation' is not part of the fix, but something I did during study making it easier for me to understand the meaning of it. Feel free to disagree on that change. The naming beg-indentation does not re-occur in python.el The patch mean to say it might be necessary to move forward on the line before search if point start off at the beginning of the defun, to allow re-search-backward to succeed on the intended place. The patch fixes this report, but it doesn't allow narrowing nested python defuns (like a def in a class). For that I think it is necassary to look at narrow-to-defun. I intend to suggest something about that in another report. What do you think? Best regards -- Tomas