ipython emacs IndentationError

Bug #1252978 reported by Andreas Roehler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Opinion
Medium
Andreas Roehler

Bug Description

http://stackoverflow.com/questions/10920562/ipython-emacs-indentationerror

Really annoying problem in ipython prompt in emacs:

In [128]: if 1==1:
   .....: print "yes"
   .....: else:
   .....: print "no"
   .....:
IndentationError: unindent does not match any outer indentation level

It looks perfectly aligned to me, not sure what trigger the error. No such problem when I do this in terminal.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

A solution is given at the very place:

;;;;;;;;;;;;

You might try toggling autoindent with

%autoindent

since I think that has caused the problem for me before.

You can change this permanently using ipython's customization. After the proper imports (see the link) the following should work in ipy_user_conf.py:

# Emacs sets the term to dumb so we can distinguish that way
if os.environ['TERM'] == 'dumb':
    ip.options.autoindent = 0

;;;;;;;;;;

Remains the question how to deal with this from python-mode.el

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: High → Medium
Changed in python-mode:
status: Confirmed → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.