]> git.eshelyaron.com Git - emacs.git/commitdiff
Fixed indentation of multi-line function call's closing parenthesis
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:03 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:03 +0000 (00:03 -0300)
lisp/progmodes/python.el

index 1fd4f326d3cdc9851a0502f903652e75dc513fd5..564638c1b58d17d4c4cb4f456fb4ca3794649fc9 100644 (file)
@@ -599,24 +599,32 @@ START is the buffer position where the sexp starts."
                                       (current-indentation)))))
              indentation))
           ('inside-paren
-           (-
-            (save-excursion
-              (goto-char context-start)
-              (forward-char)
-              (save-restriction
-                (narrow-to-region
-                 (line-beginning-position)
-                 (line-end-position))
-                (forward-comment 1))
-              (if (looking-at "$")
-                  (+ (current-indentation) python-indent-offset)
-                (forward-comment 1)
-                (current-column)))
-            (if (progn
-                  (back-to-indentation)
-                  (looking-at (regexp-opt '(")" "]" "}"))))
-                python-indent-offset
-              0))))))))
+           (or (save-excursion
+                 (forward-comment 1)
+                 (looking-at (regexp-opt '(")" "]" "}")))
+                 (forward-char 1)
+                 (when (not (nth 1 (syntax-ppss)))
+                   (goto-char context-start)
+                   (back-to-indentation)
+                   (current-column)))
+               (-
+                (save-excursion
+                  (goto-char context-start)
+                  (forward-char)
+                  (save-restriction
+                    (narrow-to-region
+                     (line-beginning-position)
+                     (line-end-position))
+                    (forward-comment 1))
+                  (if (looking-at "$")
+                      (+ (current-indentation) python-indent-offset)
+                    (forward-comment 1)
+                    (current-column)))
+                (if (progn
+                      (back-to-indentation)
+                      (looking-at (regexp-opt '(")" "]" "}"))))
+                    python-indent-offset
+                  0)))))))))
 
 (defun python-indent-calculate-levels ()
   "Calculate `python-indent-levels' and reset `python-indent-current-level'."