Subject: bug#8797: Incorrect Python Indentation

From: Adrian Parker <[email-masked]>
Date: Fri, 3 Jun 2011 18:41:28 -0400

Version: Emacs 23.3.1

Steps to reproduce:

   1. Open a Python file
   2. Starting in the first column type: def some_func(
   3. Press ENTER key
   4. Press TAB key

Expected result:
The cursor should be in column 9. Under the "Code lay-out" heading at
http://www.python.org/dev/peps/pep-0008/ please see the suggestions
regarding continuation lines (note: its a very new change).

Actual result:
The cursor is in column 5.

turbofail in #emacs on Freenode suggested I edit my python.el and:

Replace this line:
(+ (current-indentation) (* (car syntax) python-indent))))

with this line:
(+ (current-indentation) (* 2 (car syntax) python-indent))))

That fixed the issue using an older version of Emacs at work.

Note: Sorry, I'd provide a patch but I'm on windows, and haven't diff or
patch installed.

Adrian Parker