簡體   English   中英

使用Emacs保存Python文件更改了縮進

[英]Saving a Python file with Emacs changed the indentations

我以前從未發生過這種情況,但是當在Ubuntu 14.04上使用Emacs23時,兩次嘗試保存文件時縮進都發生了更改-例如

     if classRowDict[currClass] != rowCtr:
        sys.exit("About to enter %s in row %d, instead of row %d" % (currClass, rowCtr, classRowDict[currClass]))
     else:
        data=re.findall("\d+\.?\d*",currLine)

     if classRowDict[currClass] != rowCtr:
 sys.exit("About to enter %s in row %d, instead of row %d" % (currClass, rowCtr, classRowDict[currClass]))
     else:
 data=re.findall("\d+\.?\d*",currLine)

對於較大的代碼塊,這是一個更大的問題。 我將使用Emacs24修復問題,但這是第二次發生這種情況。 有沒有人看到過這樣的內容,僅保存(ctrlX-S)會使Emacs更改Python(.py)文件的縮進? 如果是這樣,我應該如何避免這種情況,或者至少將來要解決?

一些調試技巧:

  • 嘗試查看變量“ before-save-hook”,以查看保存時可能正在運行的內容。
  • 嘗試將Emacs作為“ emacs -q”運行,以刪除.emacs文件中配置的所有內容
  • 嘗試刪除代碼塊,以查看文件其余部分的縮進是否有問題。

如前所述,很可能有些鈎子做到了。 如果沒有找到原因,請嘗試從emacs -Q嘗試,加載python-mode.el並在以下位置提交錯誤報告

https://bugs.launchpad.net/python-mode

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM