emacs 23 python.el auto-indent style — can this be configured?

I have been using emacs 23 (python.el) for just over a month now and I'm unhappy with the default auto-indentation settings.

Currently, my Python files are auto-indented as follows:

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')

I would prefer if I could set the auto-indentation settings so the same code could easily be formatted:

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')

It seems that the logic for how I'd like the auto-indentation to perform would be:

If the last character (non-comment/whitespace) of the previous line is a :, increase the indent-level by 1. В противном случае используйте тот же уровень отступа.

Но, используя эту логику, TAB фактически должен увеличить уровень отступа текущей строки. (В настоящее время TAB перемещает строку только на уровень автоматического отступа)

Кто-нибудь знает, как я могу изменить автоматический отступ emacs для достижения желаемого стиля?

13
задан brildum 23 February 2011 в 17:38
поделиться