aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorTommi Komulainen2015-06-19 18:53:52 +0200
committerNoam Postavsky2019-04-28 16:45:13 -0400
commit3fc1d77a43818666542740fc34167c1faee30d5f (patch)
treea8500cefdf4d93a4c1d6918c994a0799bdc093be /lisp/progmodes/python.el
parent9469d58ebe10b280a89c77ccdc89bd2340766107 (diff)
downloademacs-3fc1d77a43818666542740fc34167c1faee30d5f.tar.gz
emacs-3fc1d77a43818666542740fc34167c1faee30d5f.zip
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
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index eb3e31c4b77..188bc973d99 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1070,12 +1070,18 @@ possibilities can be narrowed to specific indentation points."
1070 (`(,(or :after-line 1070 (`(,(or :after-line
1071 :after-comment 1071 :after-comment
1072 :inside-string 1072 :inside-string
1073 :after-backslash 1073 :after-backslash) . ,start)
1074 :inside-paren-at-closing-paren
1075 :inside-paren-at-closing-nested-paren) . ,start)
1076 ;; Copy previous indentation. 1074 ;; Copy previous indentation.
1077 (goto-char start) 1075 (goto-char start)
1078 (current-indentation)) 1076 (current-indentation))
1077 (`(,(or :inside-paren-at-closing-paren
1078 :inside-paren-at-closing-nested-paren) . ,start)
1079 (goto-char (+ 1 start))
1080 (if (looking-at "[ \t]*\\(?:#\\|$\\)")
1081 ;; Copy previous indentation.
1082 (current-indentation)
1083 ;; Align with opening paren.
1084 (current-column)))
1079 (`(:inside-docstring . ,start) 1085 (`(:inside-docstring . ,start)
1080 (let* ((line-indentation (current-indentation)) 1086 (let* ((line-indentation (current-indentation))
1081 (base-indent (progn 1087 (base-indent (progn