0

When editing an existing docstring in Google style you need to call a function like fill-paragraph to cut the long lines while preserving the proper indentation. However fill-paragraph will not work under Returns: and even less so under Args: with the individual arguments. E.g.,

    Returns:
        This function returns the list of dates in reverse order.

is transformed in

    Returns: This function returns the list of dates in reverse order.

Under Args:, all arguments are mixed together:

    Args:
        a: A sequence of strings representing the key of each table row to
          fetch. String keys will be UTF-8 encoded.
        b: Second argument.

is transformed in

    Args: a: A sequence of strings representing the key of each table row to
    fetch.  String keys will be UTF-8 encoded.  b: Second argument.

For Epydoc style, there is the nice minor mode python-docstring-mode that replaces fill-paragraph with python-docstring-fill. That works perfectly.

Is there a similar minor mode for Google style docstrings? Or an option based on lsp-mode/eglot or anything else? Note that I do not want to generate the docstrings but to "fill"/reformat it so that when editing it, I can reformat it automatically, typically by hitting M-q. Even reformatting just the current paragraph or argument would be nice (instead of the entire docstring).

3
  • 1
    Please don't post the same question on emacs.SE and StackOverflow. Choose one to keep and delete the other. Thx.
    – Drew
    Jan 10 at 17:37
  • 1
    All right. Here is the selected remaining question.
    – olivaw
    Jan 10 at 18:17
  • 1
    Thx............
    – Drew
    Jan 10 at 18:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.