indent explicitly set in multiline tqs

Bug #784225 reported by Barry Warsaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Undecided
Andreas Roehler

Bug Description

-----snip snip-----
def foo():
    with bar('x', """
        [hello]
-----snip snip-----

Put point at the end of the "[hello]" line and hit return. The next line should indent to column 8 but instead it indents to column 18. Normally that would be okay, but because you've explicitly dedented the preceding line, subsequent lines should indent underneath it, i.e. at column 8.

Related branches

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
Changed in python-mode:
status: New → Confirmed
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi Barry,

AFAIU tqs is not at stake here.

Would describe the rule in effect as:

"if inside a list indent is set explicitly, keep that"

Resp. would rename the report into something like:

"keep indent inside lists"

Cheers,

Andreas

Revision history for this message
Georg Brandl (gbrandl) wrote :

Hey Andreas,

can you explain your previous comment a bit more? I don't see a list involved here...

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

well, 'bar' opens an args-list.

Wrong?

OTOH:

seems we have two bugs at once in this example:

the "explicite" issue

tqs-indent should be honored if inside an list (?)

Revision history for this message
Georg Brandl (gbrandl) wrote :

Oh, ok, I wasn't thinking of argument lists.

I agree about keeping explicitly selected indentation.

Revision history for this message
Barry Warsaw (barry) wrote :

Andreas, I think you're right but I'm not positive. I do know that "old" python-mode.el mostly got this right, so it might be worth going back a bunch of revisions and doing some experimentation.

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 784225] Re: Dedented TQS indentation bug

On 18.05.2011 14:00, Barry Warsaw wrote:
> Andreas, I think you're right but I'm not positive.

Hi Barry,

AFAIS we agree with respect to intended --ie. optional possible--
behaviour at this point.

It's just to describe the rule - for clarification for me, what to do
and why.

What about that formula:

"When inside an multiline list an element is indented explicitely,
follow that indent". (?)

Cheers,

Andreas

  I do know that
> "old" python-mode.el mostly got this right, so it might be worth going
> back a bunch of revisions and doing some experimentation.
>

Revision history for this message
Barry Warsaw (barry) wrote : Re: Dedented TQS indentation bug

Hi Andreas, that certainly seems like a reasonable rule to me.

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 784225] Re: Dedented TQS indentation bug

On 18.05.2011 16:58, Barry Warsaw wrote:
> Hi Andreas, that certainly seems like a reasonable rule to me.
>

OK, thanks Barry.

I'll rename the report than pointing at "list" in it's name.

Might exist a related TQS issue though.

In this case, think it's helpful to get a separate report than.

Cheers,

Andreas

summary: - Dedented TQS indentation bug
+ explicitly dedented bug
summary: - explicitly dedented bug
+ explicitly dedented in list bug
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: explicitly dedented in list bug

Hi Barry,

after some further reflexion:

being inside a list isn't of interest either: it's just the multiline character of expression, which matters.
Must consider backslashed expressions too.

Also it's not just dedent, but any indent explicitly set.

The rule now reads:

"If inside a multiline expression indent is set explicitly, honor it."

Will change the name accordingly.

Cheers,

Andreas

summary: - explicitly dedented in list bug
+ indent explicitly set in multiline
summary: - indent explicitly set in multiline
+ indent explicitly set in multiline tqs
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi Barry,

if inside a tqs or not matters with respect to implementation/tests.
Correcting my previous post so far.

In order to provide case-tests will write another report for non-tqs issues.

Cheers,

Andreas

Changed in python-mode:
status: Confirmed → Fix Committed
Changed in python-mode:
milestone: none → 6.0
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.