Vertical alignment with opening delimiter

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

Bug Description

According to PEP-8, "[c]ontinuation lines should align wrapped elements either vertically using Python's implicit line joining inside parentheses, brackets and braces, or using a hanging indent". py-newline-and-indent does the job of aligning the next line with the opening parenthesis fine. However, when TAB is then pressed, this position is lost and multiples of py-python-offset are used instead. At the same, running M-x indent-for-tab-command or indent-according-to-mode fixes the problem.

This is with python-mode 6.1.3 and Emacs 24.3.1.

Marcin (antyfilidor)
description: updated
summary: - Indentation cycling and vertical alignment with opening delimiter
+ Vertical alignment with opening delimiter
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Please send a code example, which triggers the bug. Can't reproduce for now.

Thanks,

Andreas

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Medium
Changed in python-mode:
status: New → Incomplete
Revision history for this message
Marcin (antyfilidor) wrote :

For instance in the PEP 8 example

foo = long_function_name(var_one, var_two,
                                                   var_three, var_four)

If I press RET when the point is after "var_two,", the new line is aligned nicely with the opening brace

foo = long_function_name(var_one, var_two,
                                                   var_two_and_a_half,
                                                   var_three, var_four)

However, if I press TAB when on the second line, it first movest the text to the left edge:

foo = long_function_name(var_one, var_two,
var_two_and_a_half,
                                                   var_three, var_four)

Subsequent TABs add multiples py-python-offset, but never align the line with the opening brace again.

Revision history for this message
Marcin (antyfilidor) wrote :

Oop, apparently Launchpad messes up indentation. I hope it is clear enough though.

Changed in python-mode:
status: Incomplete → In Progress
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Please re-open if not done,
Thanks reporting,

Andreas

Changed in python-mode:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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