Emacs 24.3 python模式在函数结束后错误地缩进代码

Emacs 24.3 python模式在函数结束后错误地缩进代码,python,emacs,indentation,Python,Emacs,Indentation,我正在用Emacs编写一些Python代码,但是当我完成一个函数块并想要定义下一个函数时,该行会自动缩进: def funA(x): print("Hello!") return 1 def funB(y):<--- cursor is here, when I press RET line is automatically indented! def funA(x): 打印(“你好!”) 返回1 def funB(y):这是一个已知的错误,已在Emacs的当前开发版本

我正在用Emacs编写一些Python代码,但是当我完成一个函数块并想要定义下一个函数时,该行会自动缩进:

def funA(x):
    print("Hello!")
    return 1

def funB(y):<--- cursor is here, when I press RET line is automatically indented!
def funA(x):
打印(“你好!”)
返回1

def funB(y):这是一个已知的错误,已在Emacs的当前开发版本中修复:

作为临时修复,您可以使用此代码,这会导致
电子缩进模式
不会在冒号上重新缩进当前行:

(add-hook 'python-mode-hook
          (lambda ()
            (setq electric-indent-chars '(?\n))))