wrong guess for py-indent-offset due to backslash continuation

Bug #852052 reported by Georg Brandl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

The indent offset shouldn't be guessed from backslash continuations. I have

from long.pkg.name import long, list, of, \
     class, and, function, names

(note there are five spaces before "class", to match with the start of the pkg name.)

Since the indent of backlash-continued lines has no meaning for code, it should not be considered.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi Georg,

need a rule for that.

- a special imports rule?
or
- indent all continuation lines after first whitespace?

BTW we have several indent rules meanwhile, which don't effect execution.

Thanks,

Andreas

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

I wouldn't mind if python-mode didn't indent to column 5 on these statements (although the old python-mode did it).

But it is in any case wrong to guess the indent-offset from this, that's why I opened the bug.

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 852052] Re: wrong guess for py-indent-offset due to backslash continuation

Am 16.09.2011 22:26, schrieb Georg Brandl:
> I wouldn't mind if python-mode didn't indent to column 5 on these
> statements (although the old python-mode did it).
>
> But it is in any case wrong to guess the indent-offset from this, that's
> why I opened the bug.
>

OK, see, it's a little bit tricky.

Understand it that way: if the previous behavior is restored --which
shall be done-- indent guessing will fail.

So two issues to cure.

Andreas

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

Hi Georg,

could you check again?

thanks,

Andreas

Changed in python-mode:
status: In Progress → Fix Committed
Revision history for this message
Georg Brandl (gbrandl) wrote :

Hi Andreas,

offset guessing works now, but the indendation of the second "import" line is sometimes
computed to be sometimes 3, then pressing tab again, 5, spaces.

But sometimes it's changing between 0 and 8 spaces.

(Another comment: my example sadly is invalid syntax, since you cannot import "class":
it's a keyword.)

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 18.09.2011 07:52, schrieb Georg Brandl:
> Hi Andreas,
>
> offset guessing works now, but the indendation of the second "import" line is sometimes
> computed to be sometimes 3, then pressing tab again, 5, spaces.
>
> But sometimes it's changing between 0 and 8 spaces.
>

could you make a new tracker entry for this?

> (Another comment: my example sadly is invalid syntax, since you cannot import "class":
> it's a keyword.)
>

think it's pseudo-code obviously - saying
  class-and-function-names

Nonetheless, will changes that in test taking the example

thanks,

Andreas

Changed in python-mode:
status: Fix Committed → Fix Released
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.