emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3fc1d77 1/3: python.el: Fix close paren indentation


From: Noam Postavsky
Subject: [Emacs-diffs] master 3fc1d77 1/3: python.el: Fix close paren indentation to match pep8 (Bug#20742)
Date: Sun, 28 Apr 2019 16:46:25 -0400 (EDT)

branch: master
commit 3fc1d77a43818666542740fc34167c1faee30d5f
Author: Tommi Komulainen <address@hidden>
Commit: Noam Postavsky <address@hidden>

    python.el: Fix close paren indentation to match pep8 (Bug#20742)
    
    * 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index eb3e31c..188bc97 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]