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,