aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorkobarity2022-08-18 15:16:08 +0200
committerLars Ingebrigtsen2022-08-18 15:16:08 +0200
commitb9c6c0fb7bf396aa7ef0c53778211544d0c3499f (patch)
tree57c93dbd5d00bdb85245223797ddeaee86dadab1 /lisp/progmodes/python.el
parent74e830768dc412b7041e01882efb1a697278d462 (diff)
downloademacs-b9c6c0fb7bf396aa7ef0c53778211544d0c3499f.tar.gz
emacs-b9c6c0fb7bf396aa7ef0c53778211544d0c3499f.zip
Fix Python indentation of block continuation
* lisp/progmodes/python.el (python-indent--calculate-indentation): Fix indentation of :after-backslash-block-continuation. * test/lisp/progmodes/python-tests.el (python-indent-after-backslash-6): New test (bug#57262).
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index e1350391994..9a2d17abb4a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1238,8 +1238,14 @@ possibilities can be narrowed to specific indentation points."
1238 ;; Add one indentation level. 1238 ;; Add one indentation level.
1239 (goto-char start) 1239 (goto-char start)
1240 (+ (current-indentation) python-indent-offset)) 1240 (+ (current-indentation) python-indent-offset))
1241 (`(:after-backslash-block-continuation . ,start)
1242 (goto-char start)
1243 (let ((column (current-column)))
1244 (if (= column (+ (current-indentation) python-indent-offset))
1245 ;; Add one level to avoid same indent as next logical line.
1246 (+ column python-indent-offset)
1247 column)))
1241 (`(,(or :inside-paren 1248 (`(,(or :inside-paren
1242 :after-backslash-block-continuation
1243 :after-backslash-dotted-continuation) . ,start) 1249 :after-backslash-dotted-continuation) . ,start)
1244 ;; Use the column given by the context. 1250 ;; Use the column given by the context.
1245 (goto-char start) 1251 (goto-char start)