aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorkobarity2022-06-21 13:37:08 +0200
committerLars Ingebrigtsen2022-06-21 13:37:08 +0200
commit3491c7a322dd3d7b67f52a90605181c51fbe5881 (patch)
treeba1aa9050bc0f50fc380065ef526d36d6a8f1665 /lisp/progmodes/python.el
parenta5387dec4eb12ff668e531f323efd8b28540c9a2 (diff)
downloademacs-3491c7a322dd3d7b67f52a90605181c51fbe5881.tar.gz
emacs-3491c7a322dd3d7b67f52a90605181c51fbe5881.zip
Fix nested defuns handling in `python-nav-beginning-of-defun'
* lisp/progmodes/python.el (python-nav--beginning-of-defun): Fix handling of nested defuns (bug#56105).
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index c2483436fe9..e0c937d7ce5 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1455,11 +1455,17 @@ With positive ARG search backwards, else search forwards."
1455 (line-beg-pos (line-beginning-position)) 1455 (line-beg-pos (line-beginning-position))
1456 (line-content-start (+ line-beg-pos (current-indentation))) 1456 (line-content-start (+ line-beg-pos (current-indentation)))
1457 (pos (point-marker)) 1457 (pos (point-marker))
1458 (min-indentation (+ (current-indentation)
1459 (if (python-info-looking-at-beginning-of-defun)
1460 python-indent-offset 0)))
1458 (body-indentation 1461 (body-indentation
1459 (and (> arg 0) 1462 (and (> arg 0)
1460 (save-excursion 1463 (save-excursion
1461 (while (and 1464 (while (and
1462 (not (python-info-looking-at-beginning-of-defun)) 1465 (or (not (python-info-looking-at-beginning-of-defun))
1466 (>= (current-indentation) min-indentation))
1467 (setq min-indentation
1468 (min min-indentation (current-indentation)))
1463 (python-nav-backward-block))) 1469 (python-nav-backward-block)))
1464 (or (and (python-info-looking-at-beginning-of-defun) 1470 (or (and (python-info-looking-at-beginning-of-defun)
1465 (+ (current-indentation) python-indent-offset)) 1471 (+ (current-indentation) python-indent-offset))