emacs python-mode questions: C-c C-c and broken docstring fill

Bernhard Herzog bh at intevation.de
Mon Jul 28 06:44:31 EDT 2003


jjl at pobox.com (John J. Lee) writes:

> 2. A while ago I 'upgraded' to a version of python-mode (from
> somewhere on sourceforge, I think -- perhaps Python CVS, don't
> remember) which somebody here claimed was able to fill comments
> without needing blank lines before and after the comment.  It does do
> that, but the new version also breaks filling text in docstrings
> (under particular circumstances which I haven't figured out, but which
> occurs very frequently).  I get something like: "The parameter start
> is not the beginning of a python string".  Where does the latest
> python-mode live, and is this fill bug with docstrings fixed?

One situation where this can happen is if point is the at the @ in the
following triple quoted string:

"""nobody expects the "spanish" @inquision"""

The following patch should fix this I think (I haven't tested this very
well though):

*** python-mode.el.~4.35.~	Sat Jul 19 17:28:04 2003
--- python-mode.el	Mon Jul 28 12:25:04 2003
***************
*** 3714,3720 ****
        (py-fill-comment justify))
       ;; are we inside a string?
       ((nth 3 pps)
!       (py-fill-string (nth 2 pps)))
       ;; otherwise use the default
       (t
        (fill-paragraph justify)))))
--- 3714,3720 ----
        (py-fill-comment justify))
       ;; are we inside a string?
       ((nth 3 pps)
!       (py-fill-string (nth 8 pps)))
       ;; otherwise use the default
       (t
        (fill-paragraph justify)))))


   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/




More information about the Python-list mailing list