bug?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug?

Glenn Linderman-3
python.el all of a sudden started acting weird... putting in "real"
TABs, and not positioning the cursor properly, so I decided maybe I
should finally get off my duff and switch to python-mode.el -- so it
doesn't put in "real" TABs, but it also was sometimes not positioning
the cursor properly :(

I finally figured out the cause, but not a cure... I had a large block
comment string and above that python-mode works, below it does not.

Now in trying to reproduce this to report it, I tried a smaller case,
but it works!

"""
A big block comment like this doesn't seem to throw off the indentation
"""


The sad part, then, is that the effect is string content dependent!  
Maybe it has something to do with single quote stuff inside triple quote
stuff?  Well, maybe.  I had 2.5 such.

So here is a minimal test case:


"""
"
"""

def foo( bar ):
_ # cursor stays at left margin instead of indenting.


Is this something that is fixable?  I didn't try triple single quotes
containing unbalanced single quotes or mixing the type of quotes, but
those are things that should be tested too, given this failure.

It really shouldn't matter what is inside the triple quotes.  Before I
figured out what the problem was related to, I experienced some bizarre
behavior with python.el (but not with python-mode.el, but I don't know
what triggered it, to try again), where with the unbalanced strings, it
was displaying some code as code, but then after point somewhere (next
line) was displaying a block in brown as if it were a string.  I thought
I had accidentally hit a key I didn't know what it did and changed some
setting in python.el that I didn't know about (which is most of
them).... it was probably related to this issue, however.

And, sorry, I don't know yet how to search for preexisting problems and
reported bugs yet, or where to report them, but I found this list and
joined it, thinking I'd be asking for help changing configuration
settings from "goofy" to "normal", but in making a test case to report,
came to a better understanding of the bug, enough to think it is one.

Glenn




_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: bug?

Barry Warsaw
On Jan 14, 2011, at 09:49 PM, Glenn Linderman wrote:

>So here is a minimal test case:
>
>
>"""
>"
>"""
>
>def foo( bar ):
>_ # cursor stays at left margin instead of indenting.

Confirmed with r390 of python-mode.el.  It's definitely that embedded double
quote.  Change it to a single quote and indentation works just fine.

I know Andreas has been working hard in this area for the past week or so, so
I'll let him follow up.  I'm not filing this as a bug, but if you look at

    https://bugs.launchpad.net/python-mode

you'll see several tqs related problems (most are fix committed).

-Barry

P.S. Welcome to the list!

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: bug?

Andreas Röhler-2
Am 15.01.2011 16:49, schrieb Barry Warsaw:

> On Jan 14, 2011, at 09:49 PM, Glenn Linderman wrote:
>
>> So here is a minimal test case:
>>
>>
>> """
>> "
>> """
>>
>> def foo( bar ):
>> _ # cursor stays at left margin instead of indenting.
>
> Confirmed with r390 of python-mode.el.  It's definitely that embedded double
> quote.  Change it to a single quote and indentation works just fine.
>
> I know Andreas has been working hard in this area for the past week or so, so
> I'll let him follow up.  I'm not filing this as a bug, but if you look at
>
>      https://bugs.launchpad.net/python-mode
>
> you'll see several tqs related problems (most are fix committed).
>
> -Barry
>
> P.S. Welcome to the list!
>

Hi Barry,

gladly announce: just checked in a syntax independend
string parser with branch `paragraph-fill-warts',
addressing a similar bug.

A syntax independend parser delivers much more BTW than
this workaround ... :-)

Beside fixing/re-designing `py-fill-paragraph'
`py-fill-string' based on the new parser, a couple of
new functions are available.

Made an extract from thing-at-point-utils.el, called
`triplequoted.el'

Also delivering files needed by resp. holding the parser.

The full stuff is at

https://code.launchpad.net/s-x-emacs-werkstatt/

RATIONALE of re-design:

When detecting if inside a triple-quoted-string etc.,
the borders of the object are already known in this
course. Which might be given to fill the string...


Available forms for example:


`ar-triplequoted-atpt' - finds triplequoted strings under cursor
`ar-bounds-of-triplequoted-atpt'

...


`ar-triplequoted-dq-atpt' -  triplequoted strings using doublequotes
...


`ar-triplequoted-sq-atpt' - triplequoted strings using singlequotes
...


`ar-quoted-atpt'

...


`ar-doublequoted-atpt'

...


`ar-singlequoted-atpt'

...


Status: experimental,


Remaining/new BUG :(

error message when loading:


"Error in menu-bar-update-hook: (wrong-type-argument stringp nil)"


Comments welcome

Enjoy


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/


_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode