Reputation: 2279
I am writing some Python code in Emacs, but when I have finished a function block and I want to define the next function, the line is automatically indented:
def funA(x):
print("Hello!")
return 1
def funB(y):<--- cursor is here, when I press RET line is automatically indented!
As def
is supposed to be in the first column, how can I make Emacs not do this?
Upvotes: 1
Views: 302
Reputation: 1216
This is a known bug which has been fixed in the current development version of Emacs:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18228
As a temporary fix, you can use this code, which causes electric-indent-mode
not to re-indent the current line on a colon:
(add-hook 'python-mode-hook
(lambda ()
(setq electric-indent-chars '(?\n))))
Upvotes: 3