Reputation: 12183
My default python mode in emacs indents the following multiline code this way:
mydict = {
"a": 1,
"b": 2,
}
which is okay as of PEP8
I' d rather use the following style:
mydict = {
"a": 1,
"b": 2,
}
which is also ok with PEP8.
How do I tell emacs to indent the last parenthesis accordingly to the beginning of the previous line?
Upvotes: 0
Views: 719
Reputation: 10955
Just install the latest python-mode.el (from https://launchpad.net/python-mode).
In the latest version 6.1.4, the PEP8 "indent-alternatives when closing a list" is implemented (see release notes.)
In your case, you don't have to customize it, and just accept the default.
By default, py-close-at-start-column-p
is nil
, which looks like:
my_list = [
1, 2, 3,
4, 5, 6,
]
result = some_function_that_takes_arguments(
'a', 'b', 'c',
'd', 'e', 'f',
)
Upvotes: 1