在python-mode.el中使用反斜线延续的适当的缩写 [英] Proper indendation with backslash line continuations in python-mode.el
问题描述
我喜欢使用python-mode.el和(gnu)emacs来编辑我的python文件。如果我使用括号进行多行连续,则缩进按照我的预期工作。例如,
foo_long_long_long_long =(
bar_long_long_long_long [
(x_long_long_long_long == X)&
(y_long_long_long_long == Y)])
只是我喜欢的方式。 >
另一方面,如果我使用反斜杠进行连续,则会创建一个缩进,所有后续行都将停止使用额外的缩进逻辑。在第三和第四行以下没有任何额外的缩进
foo_long_long_long_long = \
bar_long_long_long_long [
(x_long_long_long_long == X)&
(y_long_long_long_long == Y)]
有谁知道如何修复python模式。 el(5.1.0),以便反斜杠的延续与括号延续相同?
编辑: strong>虽然我很高兴整天都使用括号(python毕竟是lisp就像...),我与使用反斜杠延续的其他人合作。当我按TAB时,Emacs会弄乱缩进,我经常做一个反射。在使用反斜线延续时,能够编辑他们的文件并使emacs保持所有缩进的聪明才好。
p>不要使用黑名单继续。
I like to use python-mode.el and (gnu) emacs for editing my python files. If I use parentheses for multiline continuations, indentation 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.
这篇关于在python-mode.el中使用反斜线延续的适当的缩写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!