diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ffc6c1ac885..8b8002b84b7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -897,16 +897,27 @@ possible indentation levels and saves it in the variable | |||
| 897 | `python-indent-levels'. Afterwards it sets the variable | 897 | `python-indent-levels'. Afterwards it sets the variable |
| 898 | `python-indent-current-level' correctly so offset is equal | 898 | `python-indent-current-level' correctly so offset is equal |
| 899 | to (`nth' `python-indent-current-level' `python-indent-levels')" | 899 | to (`nth' `python-indent-current-level' `python-indent-levels')" |
| 900 | (if (or (and (eq this-command 'indent-for-tab-command) | 900 | (or |
| 901 | (eq last-command this-command)) | 901 | (and (or (and (eq this-command 'indent-for-tab-command) |
| 902 | force-toggle) | 902 | (eq last-command this-command)) |
| 903 | (if (not (equal python-indent-levels '(0))) | 903 | force-toggle) |
| 904 | (python-indent-toggle-levels) | 904 | (not (equal python-indent-levels '(0))) |
| 905 | (python-indent-calculate-levels)) | 905 | (or (python-indent-toggle-levels) t)) |
| 906 | (python-indent-calculate-levels)) | 906 | (python-indent-calculate-levels)) |
| 907 | (beginning-of-line) | 907 | (let* ((starting-pos (point-marker)) |
| 908 | (delete-horizontal-space) | 908 | (indent-ending-position |
| 909 | (indent-to (nth python-indent-current-level python-indent-levels)) | 909 | (+ (line-beginning-position) (current-indentation))) |
| 910 | (follow-indentation-p | ||
| 911 | (or (bolp) | ||
| 912 | (and (<= (line-beginning-position) starting-pos) | ||
| 913 | (>= indent-ending-position starting-pos)))) | ||
| 914 | (next-indent (nth python-indent-current-level python-indent-levels))) | ||
| 915 | (unless (= next-indent (current-indentation)) | ||
| 916 | (beginning-of-line) | ||
| 917 | (delete-horizontal-space) | ||
| 918 | (indent-to next-indent) | ||
| 919 | (goto-char starting-pos)) | ||
| 920 | (and follow-indentation-p (back-to-indentation))) | ||
| 910 | (python-info-closing-block-message)) | 921 | (python-info-closing-block-message)) |
| 911 | 922 | ||
| 912 | (defun python-indent-line-function () | 923 | (defun python-indent-line-function () |