The following lines within python-indent--calculate-indentation
determine the indent after a paren not following a newline:
(defun python-indent--calculate-indentation ()
...
(pcase (python-indent-context)
...
(`(,(or :inside-paren
:after-backslash-block-continuation
:after-backslash-dotted-continuation) . ,start)
;; Use the column given by the context.
(goto-char start)
(current-column))
...
)
)
The result of the form (current-column)
is the calculated indentation. It is hard-coded and changing the indentation after a paren requires changing the code.
You could do that in the following way:
(defcustom phyton-indent-add-after-paren python-indent-offset
"Additional indent after paren."
:type 'number
:group 'python)
(defun python-indent--calculate-indentation ()
...
(pcase (python-indent-context)
...
(`(:inside-paren . ,start)
(goto-char start)
(+ (current-column) phyton-indent-add-after-paren))
(`(,(or :after-backslash-block-continuation
:after-backslash-dotted-continuation) . ,start)
;; Use the column given by the context.
(goto-char start)
(current-column))
...
)
)
Alternatively, you could use the following advice in your init file:
(defcustom phyton-indent-add-after-paren python-indent-offset
"Additional indent after paren without following newline."
:type 'number
:group 'python)
(defun python-indent-calc-indent-ad (fun)
"Change indent after opening paren with `phyton-indent-add-after-paren'.
This is an around advice for `python-indent--calculate-indentation'."
(save-excursion
(let* ((info (python-indent-context))
(ctx (car info))
(start (cdr info)))
(if (eq ctx :inside-paren)
(progn
(goto-char start)
(+ (current-column) python-indent-offset))
(funcall fun)))))
(advice-add 'python-indent--calculate-indentation :around #'python-indent-calc-indent-ad)
This is less efficient than the modification of python-indent--calculate-indentation
since the heavy duty function python-indent-context
is called twice. But if you do not notice the slow down, it should be okay.
Note, this is valid for Emacs 28.1.
It may be that other Emacs versions require other changes.
You could issue a feature request at debbugs. See an SE-answer about feature requests.