Note that there are some explanatory texts on larger screens.

plurals
  1. POelectric-indent-mode breaks my Python code
    primarykey
    data
    text
    <p>I have this code on Emacs with <code>python-mode</code> enabled:</p> <pre><code>def func(a): if a: return True return False </code></pre> <p>When I move the cursor between <code>return False</code> and <code>def func(</code> the code is automatically indented, breaking it:</p> <pre><code>def func(a): if a: return True return False #Oops! </code></pre> <p>I came to know that this happens because of <code>electric-indent-mode</code>, a minor global mode. However, I tried to turn it off, but the issue remains.</p> <p>The elisp code that I use is this:</p> <pre><code>(defun disable-electric-indent () (set (make-local-variable 'electric-indent-functions) (list (lambda (arg) 'no-indent)))) </code></pre> <p>and this how my <code>python-mode-hook</code> looks:</p> <pre><code>(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))) </code></pre> <p>If I turn off <code>auto-indent-mode</code> this behavior stops (however, I don't get auto indentation, glol).</p> <p>my emacs version: <code>GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.1) of 2013-04-29 on eric</code></p> <p><strong>EDIT</strong>: I'm using the <code>python</code> package (the built-in Python's flying circus support for Emacs, you know) in its version <code>0.24.2</code>, according to melpa. Maybe I should remove it and use <code>python-mode</code> package in its version 6.0.10?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload