glyph / python-docstring-mode

Emacs minor-mode for editing Python docstrings.
MIT License
70 stars 22 forks source link

Don't reflow doctest blocks in epytext #25

Closed wecassidy closed 6 years ago

wecassidy commented 6 years ago

When I hit M-q, doctest blocks are reflowed when the should be left alone. For example,

"""
Example docstring.

    >>> print("Hi!")
    >>> print("This is a doctest block.")

And some more text.
"""

becomes

"""
Example docstring.

>>> print("Hi!") >>> print("This is a doctest block")

And some more text.
"""

The doctest block (in the middle) lost its indentation and the two lines were placed one after the other.

glyph commented 6 years ago

Does epytext actually recognize these as blocks? Hmm.

wecassidy commented 6 years ago

Not actually an issue. I was formatting the blocks wrong. The paragraph before the block is supposed to close with two colons. When they're formatted correctly, the plugin indents as expected.

glyph commented 6 years ago

Thanks for following up! That is indeed how I thought it worked :)