diff options
| author | kobarity | 2022-06-21 13:37:08 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-06-21 13:37:08 +0200 |
| commit | 3491c7a322dd3d7b67f52a90605181c51fbe5881 (patch) | |
| tree | ba1aa9050bc0f50fc380065ef526d36d6a8f1665 /lisp/progmodes/python.el | |
| parent | a5387dec4eb12ff668e531f323efd8b28540c9a2 (diff) | |
| download | emacs-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.el | 8 |
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)) |