From 8dc2e7275d68d2749822b59e4748794ab27621c5 Mon Sep 17 00:00:00 2001 From: Gustaf Waldemarson Date: Tue, 4 Apr 2023 14:04:44 +0200 Subject: [PATCH] Allow indent in long python-mode conditionals. * lisp/progmodes/python.el: Allow additional indentation in parentheses to more easily satisfy various Python linters. --- lisp/progmodes/python.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index bbabce80b4d..d7c6a9218c7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1248,6 +1248,11 @@ python-indent-offset :type 'integer :safe 'integerp) +(defcustom python-indent-add-after-paren python-indent-offset + "Additional indent after paren." + :type 'number + :group 'python) + (defcustom python-indent-guess-indent-offset t "Non-nil tells Python mode to guess `python-indent-offset' value." :type 'boolean @@ -1580,7 +1585,10 @@ python-indent--calculate-indentation ;; Add one level to avoid same indent as next logical line. (+ column python-indent-offset) column))) - (`(,(or :inside-paren + (`(:inside-paren . ,start) + (goto-char start) + (+ (current-column) python-indent-add-after-paren)) + (`(,(or :after-backslash-block-continuation :after-backslash-dotted-continuation) . ,start) ;; Use the column given by the context. (goto-char start) -- 2.34.1