【问题标题】:wrong indentation of multi-line python statement in emacsemacs中多行python语句的错误缩进
【发布时间】:2012-07-17 21:00:05
【问题描述】:

使用Tab,我只能缩进如下样式的代码:

for ave, sd, dG, seq_pair in zip(open(predictedAve), open(predictedSD),
open(dG), open(dynLis)):

而不是这个:

for ave, sd, dG, seq_pair in zip(open(predictedAve), open(predictedSD),
                                 open(dG), open(dynLis)):

前一种风格很丑。更糟糕的是,它会使for 循环内的语句缩进变得不可能。如何在 emacs 中通过 Tabs 实现后一种缩进?

【问题讨论】:

  • 你使用的是什么版本的 Emacs 和什么 python 模式?我尝试使用emacs -Q 运行 Emacs 24.1,粘贴您的第一个代码块,移动到第二行并按 Tab。第二个块中缩进的代码就是结果。你得到了什么?

标签: python emacs tabs indentation multiline


【解决方案1】:

您可以检查您是否启用了python-mode

【讨论】:

  • 或者可能有一些语法错误,就像它认为你在一个字符串中。
  • 已启用。后来我发现问题是缓冲区中另一个不完整的语句引起的。还是谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多