开发者

Proper indendation with backslash line continuations in python-mode.el

开发者 https://www.devze.com 2023-01-14 04:02 出处:网络
I like to use python-mode.el and (gnu) emacs for editing my python files.If I use parentheses for multiline continuations, inden开发者_开发百科tation works as I expect.For example,

I like to use python-mode.el and (gnu) emacs for editing my python files. If I use parentheses for multiline continuations, inden开发者_开发百科tation works as I expect. For example,

foo_long_long_long_long = (
    bar_long_long_long_long[
        (x_long_long_long_long == X) &
        (y_long_long_long_long == Y)])

is just the way I like it.

On the other hand, if I use a backslash for continuations, a single indentation is created and all subsequent lines stop using the extra indentation logic. Below the third and fourth lines fail to have any extra indentation

foo_long_long_long_long = \
    bar_long_long_long_long[
    (x_long_long_long_long == X) &
    (y_long_long_long_long == Y)]

Does anyone know how to fix python-mode.el (5.1.0) so that backslash continuations indent the same as parenthesis continuations?


EDIT: Although I'm happy to just use parens all day long (python is after all, rather lisp like...), I collaborate with others who use backslash continuations. Emacs messes up the indentation when I press TAB, which I often do as a reflex. It'd be nice to be able to edit their files and have emacs keep all its indentation smarts when working with backslash line continuations.


Don't use blackslash continuations.


This got Bug lp:629916, fixed in https://launchpad.net/python-mode

0

精彩评论

暂无评论...
验证码 换一张
取 消