My setup is Emacs 24.4.1, Linux, Python source code open in a buffer, Python mode 0.24.4 (comes with Emacs), fill-column set to 70, python-fill-docstring-style set to nil. I call fill-paragraph (M-q) from within a class method docstring to re-format the docstring such that no line is longer than 70 characters. But the first line of the docstring is always longer. Looks like the indentation (8 spaces) is not included in the line length calculation. What can I do to limit the line length to 70? Should I use python-mode.el instead?
Example:
class MyClass(object):
def my_method(self):
"""Some long line with more than 70 characters in the docstring. Some more text."""
After M-q in the docstring it looks like this. The first method docstring line ends at column 78 (and the second line is not indented, but that's a different issue):
class MyClass(object):
def my_method(self):
"""Some long line with more than 70 characters in the docstring. Some
more text."""
But with a line length of 70 it should be like this:
class MyClass(object):
def my_method(self):
"""Some long line with more than 70 characters in the
docstring. Some more text."""
With with current trunk of python-mode.el, r1993, and default style pep-257-nn
it M-q yields
class MyClass(object):
def my_method(self):
"""Some long line with more than 70 characters in the docstring.
Some more text.
"""
My answer consists of two parts:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With