Emacs' python-mode buggy?

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Thu Apr 29 11:36:16 EDT 1999


>>>>> "TP" == Tim Peters <tim_one at email.msn.com> writes:

    |     """
    |        "Hi!" I'm a doc string
    |     """

    TP> Emacs "sees" it as a sequence of 4 strings with some crap in
    TP> the middle:

    |     ""
    |     "\n        "
    |     Hi!
    |     " I'm a doc string\n    "
    |     ""

    TP> elisp is too slow to do the character-at-a-time parsing that
    TP> would be needed to fix cases like this, so-- like all other
    TP> language modes --pymode settles for what it can get.  AFAIK it
    TP> should *never* screw up in the absence of triple-quoted
    TP> strings, though, and you can help it make sense of those by
    TP> pretending you're the Emacs C parsing function, using
    TP> judicious backslash escapes until you stop confusing yourself
    TP> <wink>.

Try something like the following for fun

-------------------- snip snip --------------------
'''Hey!  I thought I warned you.
Don't even think about it!
'''
# yikes! Emacs thinks this is a string
# add a turd '
# now we're happy again
-------------------- snip snip --------------------

-B




More information about the Python-list mailing list