bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56105: 29.0.50; python-nav-beginning-of-defun does not handle nested


From: kobarity
Subject: bug#56105: 29.0.50; python-nav-beginning-of-defun does not handle nested functions properly
Date: Mon, 20 Jun 2022 21:01:49 +0900

Hi,

In python-nav--beginning-of-defun, body-indentation is expected to be
the indentation level of the body of the current function. It is
calculated by searching blocks backward for defuns and adding
python-indent-offset. However, the found defun is not always the defun
for the current function, because there may be nested functions.

Attached is a patch to fix this issue. In this patch, min-indentation
is introduced to keep track of the minimum indentation of the current
function body to distinguish nested defuns from current defun.
(python-info-looking-at-beginning-of-defun) in the initialization of
min-indentation is a special case. In this case,
python-nav-beginning-of-defun is expected to navigate to the previous
defun of the same level, not the enclosing defun.

There is a test case for this issue in
python-nav-beginning-of-defun-1, but unfortunately the expectation is
wrong. I corrected it and added some tests including a test with
python-mark-defun in this patch.

Best Regards,

Attachment: fix-56105.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]