From: Lars Ingebrigtsen <larsi@gnus.org>
Date: Thu, 4 Nov 2021 17:47:04 +0000 (+0100)
Subject: Fix return value of python-nav-end-of-defun
X-Git-Tag: emacs-29.0.90~3671^2~252
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1def47fd98449aee5b13741abcb52909ed8c40ac;p=emacs.git

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).
---

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.