From 1def47fd98449aee5b13741abcb52909ed8c40ac Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 4 Nov 2021 18:47:04 +0100 Subject: [PATCH] Fix return value of python-nav-end-of-defun * lisp/progmodes/python.el (python-nav-end-of-defun): Return non-nil if in a def/class, as the doc string implies (bug#51601). --- lisp/progmodes/python.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 34bff0152ec..7b0295afb74 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1518,7 +1518,10 @@ Returns nil if point is not in a def or class." (python-util-forward-comment -1) (forward-line 1) ;; Ensure point moves forward. - (and (> beg-pos (point)) (goto-char beg-pos))))) + (and (> beg-pos (point)) (goto-char beg-pos)) + ;; Return non-nil if we did something (because then we were in a + ;; def/class). + (/= beg-pos (point))))) (defun python-nav--syntactically (fn poscompfn &optional contextfn) "Move point using FN avoiding places with specific context. -- 2.39.2