]> git.eshelyaron.com Git - emacs.git/commitdiff
Enhancements to `python-indent-post-self-insert-function'
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:42 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:42 +0000 (00:03 -0300)
Fixed case where the paren base indentation is not 0.

lisp/progmodes/python.el

index e549c477233efae4ebb5d52c8e35f98c36f1b8b8..4e9c045d1841e4a9bc8de8db5fb946b7951c0623 100644 (file)
@@ -990,19 +990,16 @@ This function is intended to be added to the
 adding a char before it, the line will be re-indented
 automatically if needed."
   (when (and (eq (char-before) last-command-event)
-             (= (current-indentation) 0)
              (not (bolp))
              (memq (char-after) '(?\) ?\] ?\})))
-    (let ((indentation (save-excursion
-                         ;; If after going to the beginning of line the point
-                         ;; is still inside a paren it's ok to do the trick
-                         (goto-char (line-beginning-position))
-                         (when (python-info-ppss-context 'paren)
-                           (python-indent-calculate-indentation)))))
-      (when (and indentation
-                 (< (current-indentation) indentation))
-        (save-excursion
-          (indent-line-to indentation))))))
+    (save-excursion
+      (goto-char (line-beginning-position))
+      ;; If after going to the beginning of line the point
+      ;; is still inside a paren it's ok to do the trick
+      (when (python-info-ppss-context 'paren)
+        (let ((indentation (python-indent-calculate-indentation)))
+          (when (< (current-indentation) indentation)
+            (indent-line-to indentation)))))))
 
 \f
 ;;; Navigation