I have this code on Emacs with python-mode
enabled:
def func(a):
if a:
return True
return False
When I move the cursor between return False
and def func(
the code is automatically indented, breaking it:
def func(a):
if a:
return True
return False #Oops!
I came to know that this happens because of electric-indent-mode
, a minor global mode. However, I tried to turn it off, but the issue remains.
The elisp code that I use is this:
(defun disable-electric-indent ()
(set (make-local-variable 'electric-indent-functions)
(list (lambda (arg) 'no-indent))))
and this how my python-mode-hook
looks:
(add-hook 'python-mode-hook
(lambda ()
(flyspell-prog-mode)
(auto-complete-mode)
(nlinum-mode)
(toggle-truncate-lines t)
(setq autopair-handle-action-fns
(list 'autopair-default-handle-action 'autopair-python-triple-quote-action))
(centered-cursor-mode)
(auto-indent-mode)
(autopair-mode)
(column-marker-1 80)
(flycheck-mode)
(setq ac-auto-start 2)
(disable-electric-indent) ;; esto deberia hacer que emacs deje de romper las pelotas con el codigo en python
(jedi:setup)))
If I turn off auto-indent-mode
this behavior stops (however, I don't get auto indentation, glol).
my emacs version: GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.1) of 2013-04-29 on eric
EDIT: I'm using the python
package (the built-in Python's flying circus support for Emacs, you know) in its version 0.24.2
, according to melpa. Maybe I should remove it and use python-mode
package in its version 6.0.10?