From 65e4f7642eb551e6cfb8757cba84246a33b19590 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Thu, 17 May 2012 00:03:17 -0300 Subject: [PATCH] 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. --- lisp/progmodes/python.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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))))) -- 2.39.5