Comment 2 for bug 1178455

Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 1178455] Re: Bogus whitespace left in docstring after wrapping

On May 13, 2013, at 05:28 PM, Andreas Roehler wrote:

>the docstring get's indented as such. I.e. it get's the indentation a C-j
>from inside would make. Do you think that's wrong? Is there a case where it
>disturbs?

Yes. Take the following example:

def foo():
    """This is the foo method.

    The foo method does stuff.
    It does other stuff too.
    Oh, but it does not do some other stuff.

    Use the foo method with caution.
    """

In this case, you'll notice that the blank lines surrounding the middle
paragraph are indeed blank. No indentation is present.

Now use M-q to re-fill the middle paragraph. The separating lines suddenly
grow 4 leading spaces making them non-empty. Normally, you can't see the
spaces unless you turn on global-whitespace-mode or similar, but that makes
the problem worse.

Imagine you have a unit test that requires those lines to be really blank,
i.e. empty. M-q would break those tests.

Thus, it is critical that filling a paragraph not change the indentation of
the surrounding blank lines.