diff options
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f31832fec9c..b8fc7d4c546 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1459,8 +1459,11 @@ With positive ARG search backwards, else search forwards." (current-indentation))) (body-indentation (and (> arg 0) - (or (and (python-info-looking-at-beginning-of-defun) - (+ (current-indentation) python-indent-offset)) + (or (and (python-info-looking-at-beginning-of-defun nil t) + (+ (save-excursion + (python-nav-beginning-of-statement) + (current-indentation)) + python-indent-offset)) (save-excursion (while (and @@ -5168,7 +5171,8 @@ likely an invalid python file." (while (and (< (point) cur-line) (setq no-back-indent (or (> (current-indentation) indentation) - (python-info-current-line-empty-p)))) + (python-info-current-line-empty-p) + (python-info-current-line-comment-p)))) (forward-line))) no-back-indent))) (setq collected-indentations |