unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8797: Incorrect Python Indentation
@ 2011-06-03 22:41 Adrian Parker
  2011-06-04  2:26 ` bug#8797: Further context Adrian Parker
  2012-06-18 21:36 ` bug#8797: Incorrect Python Indentation Glenn Morris
  0 siblings, 2 replies; 3+ messages in thread
From: Adrian Parker @ 2011-06-03 22:41 UTC (permalink / raw)
  To: 8797

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1243 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#8797: Further context
  2011-06-03 22:41 bug#8797: Incorrect Python Indentation Adrian Parker
@ 2011-06-04  2:26 ` Adrian Parker
  2012-06-18 21:36 ` bug#8797: Incorrect Python Indentation Glenn Morris
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Parker @ 2011-06-04  2:26 UTC (permalink / raw)
  To: 8797

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)





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#8797: Incorrect Python Indentation
  2011-06-03 22:41 bug#8797: Incorrect Python Indentation Adrian Parker
  2011-06-04  2:26 ` bug#8797: Further context Adrian Parker
@ 2012-06-18 21:36 ` Glenn Morris
  1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2012-06-18 21:36 UTC (permalink / raw)
  To: 8797-done

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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-18 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-03 22:41 bug#8797: Incorrect Python Indentation Adrian Parker
2011-06-04  2:26 ` bug#8797: Further context Adrian Parker
2012-06-18 21:36 ` bug#8797: Incorrect Python Indentation Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).