Commit 65e4f764 authored by Fabián Ezequiel Gallina's avatar Fabián Ezequiel Gallina Committed by Fabián Ezequiel Gallina

Fixed weird cornercase behavior in python-indent-calculate-indentation.

Doing (setq python-indent-levels '(0)) was causing the value of
python-indent-levels to not be initialized correctly on next calls to
python-indent-calculate-indentation. Using (setq python-indent-levels
(list 0)) instead does the trick but I'm not sure why.
parent 589cefd7
......@@ -723,14 +723,11 @@ START is the buffer position where the sexp starts."
(let* ((indentation (python-indent-calculate-indentation))
(remainder (% indentation python-indent-offset))
(steps (/ (- indentation remainder) python-indent-offset)))
(setq python-indent-levels '(0))
(setq python-indent-levels (list 0))
(dotimes (step steps)
(setq python-indent-levels
(cons (* python-indent-offset (1+ step)) python-indent-levels)))
(push (* python-indent-offset (1+ step)) python-indent-levels))
(when (not (eq 0 remainder))
(setq python-indent-levels
(cons (+ (* python-indent-offset steps) remainder)
(push (+ (* python-indent-offset steps) remainder) python-indent-levels))
(setq python-indent-levels (nreverse python-indent-levels))
(setq python-indent-current-level (1- (length python-indent-levels)))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment