Thank you for this!
On Sun, Nov 3, 2013 at 7:38 AM, Edward K. Ream <[email protected]> wrote: > Rev 6222 contains all the old reformat-paragraph unit tests, plus 8 new > ones. > > Please report any actual problems with this command. I probably won't be > interested in complex improvements. > > I use this command constantly while writing documentation and when > creating notes pasted from other sources. > > The new code treats the following as **single-line paragraphs** (a key > distinction, it turns out): > > @anything > """ > ''' > > Blank lines always terminate paragraphs, but the new code assumes that any > of the following start a paragraph, thereby terminating the previous > paragraph: > > 1. whatever > 1) whatever > 925. whatever > 2) whatever > - whatever > A. whatever > a) whatever > > The last two cases start with a *single* alpha character, not > a-longer-than-one-charater-word! Even this restriction could cause problem > conceivably. Deal with it... > > This is very tricky to have all this work reasonably, but the results are > worthwhile. > > Here is a test sample that I have been using:: > > @pagewidth 40 > ''' > docstring. > more docstring. > ''' > - Point 1. xxxxxxxxxxxxxxxxxxxxxxxxxxxx > Line 11. > A. Point 2. xxxxxxxxxxxxxxxxxxxxxxxxxxx > Line 22. > 1. Point 3. xxxxxxxxxxxxxxxxxxxxxxxxxxx > Line 32. > 2. Point 4 xxxxxxxxxxxxxxxxxxxxxxxxxxx > Line 41 > > The last case will leave the *extra* indentation of Line 41 as it is. > This is debatable, but I'm not really interested in the debate ;-) > > This works much better on docstrings than the Emacs. Consider this quote > from pep 257: http://www.python.org/dev/peps/pep-0257/ > > "The BDFL recommends inserting a blank line between the > last paragraph in a multi-line docstring and its closing quotes, > placing the closing quotes on a line by themselves. > This way, Emacs' fill-paragraph command can be used on it." > > Imo, this a truly wretched concession. It's no longer needed in Leo. > > Now, Leo formats both the following docstrings reasonably: > > ''' > docstring. > more docstring. > ''' > > and > > '''docstring. > more docstring. > ''' > > We could argue about further improvements, but these are good enough for > me. > > Edward > > P.S. Here is what I did: > > - Rewrote c.findBoundParagraph & added helpers: > - c.starts/endParagraph > - c.singleLineParagraph. > - Add space adjustments to rp_wrap_all_lines. > > The helpers, c.starts/endParagraph and c.singleLineParagraph are actually > the crucial new code because they create three new distinctions that were > not previously present in the code. c.endParagraph is particularly > trivial, but I wanted to make it an official helper (rather than defining > it within findBoundParagraph) so that scripts and plugins would have the > option of monkey-patching it if desired. > > EKR > > -- > You received this message because you are subscribed to the Google Groups > "leo-editor" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/leo-editor. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/groups/opt_out.
