]> git.eshelyaron.com Git - emacs.git/commitdiff
python.el: Fix close paren indentation to match pep8 (Bug#20742)
authorTommi Komulainen <tommi.komulainen@iki.fi>
Fri, 19 Jun 2015 16:53:52 +0000 (18:53 +0200)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 28 Apr 2019 20:45:13 +0000 (16:45 -0400)
* lisp/progmodes/python.el (python-indent--calculate-indentation):
When opening paren is followed by newline the closing paren should
follow the current indentation.  Otherwise the closing paren should be
aligned with the opening paren.  This fixes the latter case.

Copyright-paperwork-exempt: yes

lisp/progmodes/python.el

index eb3e31c4b77635499b88962dadcc8d034cca5903..188bc973d99d5324205558978eb1e4ed14fa565b 100644 (file)
@@ -1070,12 +1070,18 @@ possibilities can be narrowed to specific indentation points."
         (`(,(or :after-line
                 :after-comment
                 :inside-string
-                :after-backslash
-                :inside-paren-at-closing-paren
-                :inside-paren-at-closing-nested-paren) . ,start)
+                :after-backslash) . ,start)
          ;; Copy previous indentation.
          (goto-char start)
          (current-indentation))
+        (`(,(or :inside-paren-at-closing-paren
+                :inside-paren-at-closing-nested-paren) . ,start)
+         (goto-char (+ 1 start))
+         (if (looking-at "[ \t]*\\(?:#\\|$\\)")
+             ;; Copy previous indentation.
+             (current-indentation)
+           ;; Align with opening paren.
+           (current-column)))
         (`(:inside-docstring . ,start)
          (let* ((line-indentation (current-indentation))
                 (base-indent (progn