Vertical alignment with opening delimiter

Bug #1332245 reported by Marcin on 2014-06-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
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) on 2014-06-19
description: updated
summary: - Indentation cycling and vertical alignment with opening delimiter
+ Vertical alignment with opening delimiter
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
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.

Marcin (antyfilidor) wrote :

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

Changed in python-mode:
status: Incomplete → In Progress
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  Edit
Everyone can see this information.

Other bug subscribers