aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorkobarity2025-04-20 21:14:46 +0900
committerEli Zaretskii2025-04-26 14:17:31 +0300
commit55cf15e163b407878921b4428e5436f01cf1fd90 (patch)
tree38e8efba3e7ae388547affc05f8f5fbf7bb2f6b8 /lisp/progmodes/python.el
parent7bb648eb804c6420cd0f76cd8075a0faa30a4bfd (diff)
downloademacs-55cf15e163b407878921b4428e5436f01cf1fd90.tar.gz
emacs-55cf15e163b407878921b4428e5436f01cf1fd90.zip
Fix Python block end predicates (bug#77941)
* lisp/progmodes/python.el (python-info-statement-ends-block-p) (python-info-end-of-block-p): Add consideration of comments. * test/lisp/progmodes/python-tests.el (python-info-statement-ends-block-p-3) (python-info-end-of-block-p-3): New tests.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 32035773fde..b03e4f9efdf 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -6159,7 +6159,9 @@ parent defun name."
6159 (let ((end-of-block-pos (save-excursion 6159 (let ((end-of-block-pos (save-excursion
6160 (python-nav-end-of-block))) 6160 (python-nav-end-of-block)))
6161 (end-of-statement-pos (save-excursion 6161 (end-of-statement-pos (save-excursion
6162 (python-nav-end-of-statement)))) 6162 (python-nav-end-of-statement)
6163 (python-util-forward-comment -1)
6164 (point))))
6163 (and end-of-block-pos end-of-statement-pos 6165 (and end-of-block-pos end-of-statement-pos
6164 (= end-of-block-pos end-of-statement-pos)))) 6166 (= end-of-block-pos end-of-statement-pos))))
6165 6167
@@ -6182,7 +6184,10 @@ parent defun name."
6182 6184
6183(defun python-info-end-of-block-p () 6185(defun python-info-end-of-block-p ()
6184 "Return non-nil if point is at end of block." 6186 "Return non-nil if point is at end of block."
6185 (and (python-info-end-of-statement-p) 6187 (and (= (point) (save-excursion
6188 (python-nav-end-of-statement)
6189 (python-util-forward-comment -1)
6190 (point)))
6186 (python-info-statement-ends-block-p))) 6191 (python-info-statement-ends-block-p)))
6187 6192
6188(define-obsolete-function-alias 6193(define-obsolete-function-alias