(let* ((indentation (python-indent-calculate-indentation))
(remainder (% indentation python-indent-offset))
(steps (/ (- indentation remainder) python-indent-offset)))
- (setq python-indent-levels '())
- (setq python-indent-levels (cons 0 python-indent-levels))
+ (setq python-indent-levels '(0))
(dotimes (step steps)
(setq python-indent-levels
(cons (* python-indent-offset (1+ step)) python-indent-levels)))
(if (or (and (eq this-command 'indent-for-tab-command)
(eq last-command this-command))
force-toggle)
- (python-indent-toggle-levels)
+ (if (not (equal python-indent-levels '(0)))
+ (python-indent-toggle-levels)
+ (python-indent-calculate-levels))
(python-indent-calculate-levels))
(beginning-of-line)
(delete-horizontal-space)