Chris Barker pointed me to a python implementation of the TeX word wrapping algorithm:
http://www.ics.uci.edu/~eppstein/software.html which, in case you're interested, is included in a minor update of peppy: peppy-0.7.0.2 available at www.flipturn.org/peppy. The fill-paragraph (aka word wrapping) action seems to work reasonably well -- it knows what comment characters are associated with the major mode and will fill a comment block and text inside triple quotes in python mode. C/C++-style comments are coming soon. Next project other than that is getting the tab-to-indent/electric-return to work correctly. I've stepped through the elisp comments in emacs, but it would be cool if there were something in python already debugged. IDLE has newline_and_indent_event and smart_indent_event that seem to do the right thing, but of course that's written for Tkinter. Anyone have an implementation based on the STC that I can steal^H^H^H^H^Hborrow? I'd like one that works as well as the emacs version and can handle things like indenting to the right place in the middle of a list or dict definition, and what's currently in peppy is little better than just indenting to the previous line's indentation. Worse, in fact, because it gets it wrong about 20% of the time. Rob
