gabrielelanaro / emacs-for-python

Collection of emacs extensions specifically collected for python development, with workflow guidelines!
http://gabrielelanaro.github.com/emacs-for-python
GNU General Public License v3.0
810 stars 151 forks source link

auto-indenting new function signatures to the right after pressing enter #142

Open lsh-0 opened 9 years ago

lsh-0 commented 9 years ago

when writing a new python function below an existing one, pressing enter at the end of the signature to begin writing the body, the signature is auto indented to the right, as if it belonged to the function above it.

mivade commented 9 years ago

I can confirm this. It appears to be an issue with http://www.emacswiki.org/emacs/AutoIndentation in emacs 24. Some relevant things I've found while tracking down the source of the problem here and here.

A workaround is to add the following line to your .emacs:

(add-hook 'python-mode-hook (lambda() (electric-indent-mode -1)))
lsh-0 commented 9 years ago

Quick fix is much appreciated, thankyou. On 23 Feb 2015 19:02, "Mike DePalatis" notifications@github.com wrote:

I can confirm this. It appears to be an issue with http://www.emacswiki.org/emacs/AutoIndentation http://electric-indent-mode in emacs 24. Some relevant things I've found while tracking down the source of the problem here http://stackoverflow.com/questions/21182550/how-to-turn-of-electric-indent-mode-for-specific-major-mode and here http://stackoverflow.com/questions/17095247/electric-indent-mode-breaks-my-python-code .

A workaround is to add the following line to your .emacs:

(add-hook 'python-mode-hook (lambda() (electric-indent-mode -1)))

— Reply to this email directly or view it on GitHub https://github.com/gabrielelanaro/emacs-for-python/issues/142#issuecomment-75608319 .