From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:03:17 +0000 (-0300) Subject: Fixed weird cornercase behavior in python-indent-calculate-indentation. X-Git-Tag: emacs-24.2.90~1199^2~561 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=65e4f7642eb551e6cfb8757cba84246a33b19590;p=emacs.git 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. --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 24fb37259b3..1cd1396f24f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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) - python-indent-levels))) + (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)))))