]> git.eshelyaron.com Git - emacs.git/commitdiff
Fixed indentation issue when indenting a python-indent-dedenter from end of line
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:10 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:10 +0000 (00:03 -0300)
lisp/progmodes/python.el

index dc7e46dc1290cddedcec90d20c42328eda495d1c..b6bb825fc1aa351fff5cb14cd25b4d3bc785f46e 100644 (file)
@@ -700,8 +700,7 @@ 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 '())
-    (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)))
@@ -740,7 +739,9 @@ to (`nth' `python-indent-current-level' `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)