bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21254: 24.5; python.el: Docstring fill-paragraph not working with st


From: Stefan Kangas
Subject: bug#21254: 24.5; python.el: Docstring fill-paragraph not working with style pep-257-nn
Date: Thu, 26 Sep 2019 14:04:01 +0200

tags 21254 confirmed
found 21254 26.1
quit

Holger Schmidt <Holger.Schmidt@zmdi.com> writes:

> I write a docstring of a class method in a buffer with Python mode.
> python-fill-docstring-style is set to 'pep-257-nn.  The
> cursor is at the end of the docstring after the three quotes.
> fill-paragraph does nothing, but it should format the docstring.
>
> I move the cursor inside the docstring.  fill-paragraph formats the
> docstring with four errors: There is no newline after the first
> sentence, the first line is longer (72) than fill-column (70), the
> second line and following lines are not indented (but start at column 0),
> there is no newline at the end.  A second fill-paragraph adds the
> missing newline at the end.
>
> Example (the docstring is one long line):
>
> class MyClass(object):
>     def __init__(self):
>         """Class initialization.  According to PEP 257 there should be a 
> newline after the first sentence.  Following sentences are indented by 8 
> spaces in this case.  With python-fill-docstring-style set to 'pep-257-nn 
> there should be a newline at the end."""
>         pass
>
> This should be formatted like this:
>
> class MyClass(object):
>     def __init__(self):
>         """Class initialization.
>
>         According to PEP 257 there should be a newline after the first
>         sentence.  Following sentences are indented by 8 spaces in
>         this case.  With python-fill-docstring-style set to
>         'pep-257-nn there should be a newline at the end.
>         """
>         pass
>
> But the result is this (fill-paragraph (M-q) inside docstring):
>
> class MyClass(object):
>     def __init__(self):
>         """Class initialization.  According to PEP 257 there should be a
> newline after the first sentence.  Following sentences are indented by
> 8 spaces in this case.  With python-fill-docstring-style set to
> 'pep-257-nn there should be a newline at the end."""
>         pass

I can reproduce this on Emacs 26.1 and current master.

Best regards,
Stefan Kangas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]