[Python-mode] python-mode 3.105; M-q comment action

Barry Warsaw barry at python.org
Wed Jan 28 08:47:47 EST 2004


On Wed, 2004-01-28 at 08:15, Bernhard Herzog wrote:

> I think that never worked.  The code is quite simple minded.  It only
> tries to fill a string if the cursor is inside the string.  Placing it
> on the second quote of the opening triple quote works, for instance.  If
> the cursor is on the third it again doesn't work because Emacs doesn't
> grok triple quoted strings (at least not in the python-mode I'm
> currently using, 4.48).  There's a similar problem if the triple quoted
> string contains characters of he same quote type as the triple quote.

Ah, you're right, it works if you're inside the string.

Here's a crazy idea for anyone with a little spare hacking time. <wink>

Start by saving-excursion.  Check to see if you're in the line's
indentation, and if so, do a back-to-indentation.  Then, if
py-in-literal returns nil, do a forward-word and check if py-in-literal
== string.  If so, fill the paragraph from there, otherwise fill it from
the original position.

-Barry





More information about the Python-mode mailing list