diff options
| author | kobarity | 2022-07-16 18:14:15 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-07-16 18:26:58 +0200 |
| commit | 35d0a2e0a767838c24d5853be798313aed7a42df (patch) | |
| tree | d753ec8cb392e55964f41e2180f45608fe3dc106 /lisp/progmodes/python.el | |
| parent | 9b5eb661bf01d5b7e3453011b93f0eaf8621521e (diff) | |
| download | emacs-35d0a2e0a767838c24d5853be798313aed7a42df.tar.gz emacs-35d0a2e0a767838c24d5853be798313aed7a42df.zip | |
Fix python navigation problem with an empty line in nested defun
* lisp/progmodes/python.el (python-nav--beginning-of-defun): Fix
bug when point is on an empty line (bug#56600).
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1c99937c4b9..f31832fec9c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1454,21 +1454,24 @@ With positive ARG search backwards, else search forwards." | |||
| 1454 | (line-beg-pos (line-beginning-position)) | 1454 | (line-beg-pos (line-beginning-position)) |
| 1455 | (line-content-start (+ line-beg-pos (current-indentation))) | 1455 | (line-content-start (+ line-beg-pos (current-indentation))) |
| 1456 | (pos (point-marker)) | 1456 | (pos (point-marker)) |
| 1457 | (min-indentation (+ (current-indentation) | 1457 | (min-indentation (if (python-info-current-line-empty-p) |
| 1458 | (if (python-info-looking-at-beginning-of-defun) | 1458 | most-positive-fixnum |
| 1459 | python-indent-offset 0))) | 1459 | (current-indentation))) |
| 1460 | (body-indentation | 1460 | (body-indentation |
| 1461 | (and (> arg 0) | 1461 | (and (> arg 0) |
| 1462 | (save-excursion | 1462 | (or (and (python-info-looking-at-beginning-of-defun) |
| 1463 | (while (and | 1463 | (+ (current-indentation) python-indent-offset)) |
| 1464 | (or (not (python-info-looking-at-beginning-of-defun)) | 1464 | (save-excursion |
| 1465 | (>= (current-indentation) min-indentation)) | 1465 | (while |
| 1466 | (setq min-indentation | 1466 | (and |
| 1467 | (min min-indentation (current-indentation))) | 1467 | (python-nav-backward-block) |
| 1468 | (python-nav-backward-block))) | 1468 | (or (not (python-info-looking-at-beginning-of-defun)) |
| 1469 | (or (and (python-info-looking-at-beginning-of-defun) | 1469 | (>= (current-indentation) min-indentation)) |
| 1470 | (+ (current-indentation) python-indent-offset)) | 1470 | (setq min-indentation |
| 1471 | 0)))) | 1471 | (min min-indentation (current-indentation))))) |
| 1472 | (or (and (python-info-looking-at-beginning-of-defun) | ||
| 1473 | (+ (current-indentation) python-indent-offset)) | ||
| 1474 | 0))))) | ||
| 1472 | (found | 1475 | (found |
| 1473 | (progn | 1476 | (progn |
| 1474 | (when (and (python-info-looking-at-beginning-of-defun nil t) | 1477 | (when (and (python-info-looking-at-beginning-of-defun nil t) |