GNU bug report logs - #8797
Incorrect Python Indentation

Previous Next

Package: emacs;

Reported by: Adrian Parker <adrian.l.parker <at> gmail.com>

Date: Fri, 3 Jun 2011 23:03:02 UTC

Severity: normal

Fixed in version 24.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8797 in the body.
You can then email your comments to 8797 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8797; Package emacs. (Fri, 03 Jun 2011 23:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Adrian Parker <adrian.l.parker <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org.

Your message had a Version: pseudo-header with an invalid package version:

Emacs 23.3.1

please either use found or fixed to the control server with a correct version, or reply to this report indicating the correct version so the maintainer (or someone else) can correct it for you.

(Fri, 03 Jun 2011 23:03:02 GMT) Full text and rfc822 format available.


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Adrian Parker <adrian.l.parker <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Incorrect Python Indentation
Date: Fri, 3 Jun 2011 18:41:28 -0400
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8797; Package emacs. (Sat, 04 Jun 2011 02:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 8797 <at> debbugs.gnu.org (full text, mbox):

From: Adrian Parker <adrian.l.parker <at> gmail.com>
To: 8797 <at> debbugs.gnu.org
Subject: Further context
Date: Fri, 3 Jun 2011 22:26:05 -0400
I should have given more context on turbofails' suggestion. Here is
the diff output he provided for me:

-- a/python.el
+++ b/python.el
@@ -678,7 +678,7 @@ Set `python-indent' locally to the value guessed."
 		  ;; level per bracketing level.
 		  (goto-char (1+ open-start))
 		  (python-beginning-of-statement)
-		  (+ (current-indentation) (* (car syntax) python-indent))))
+		  (+ (current-indentation) (* 2 (car syntax) python-indent))))
 	    ;; Otherwise backslash-continued.
 	    (forward-line -1)
 	    (if (python-continuation-line-p)




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Mon, 18 Jun 2012 21:40:01 GMT) Full text and rfc822 format available.

Notification sent to Adrian Parker <adrian.l.parker <at> gmail.com>:
bug acknowledged by developer. (Mon, 18 Jun 2012 21:40:01 GMT) Full text and rfc822 format available.

Message #13 received at 8797-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 8797-done <at> debbugs.gnu.org
Subject: Re: bug#8797: Incorrect Python Indentation
Date: Mon, 18 Jun 2012 17:36:11 -0400
Version: 24.2

Thanks for the report. The Emacs trunk has a new python.el, and it seems
your problem is fixed there. This should appear in Emacs 24.2.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 17 Jul 2012 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 345 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.