bri*_*dum 13 python emacs coding-style indentation
我已经使用emacs 23(python.el)一个多月了,我对默认的自动缩进设置不满意.
目前,我的Python文件是自动缩进的,如下所示:
x = a_function_with_dict_parameter({
'test' : 'Here is a value',
'second' : 'Another value',
})
a_function_with_multiline_parameters(on='First', line='Line',
now_on='Second', next_line='Line',
next='Third', finally='Line')
Run Code Online (Sandbox Code Playgroud)
我更喜欢如果我可以设置自动缩进设置,以便可以轻松格式化相同的代码:
x = a_function_with_dict_parameter({
'test' : 'Here is a value',
'second' : 'Another value',
})
a_function_with_multiline_parameters(on='First', line='Line',
now_on='Second', next_line='Line', next='Third', finally='Line')
Run Code Online (Sandbox Code Playgroud)
似乎我喜欢自动缩进的逻辑是:
如果前一行的最后一个字符(非注释/空白)是:,则将缩进级别增加1.否则,使用相同的缩进级别.
但是使用该逻辑,TAB需要实际增加当前行的缩进级别.(目前,TAB只将行移动到自动缩进级别)
有谁知道如何修改emacs auto-indentation来实现我想要的风格?