Function: python-fill-paragraph
python-fill-paragraph is an interactive and byte-compiled function
defined in python.el.gz.
Signature
(python-fill-paragraph &optional JUSTIFY)
Documentation
fill-paragraph-function handling multi-line strings and possibly comments.
If any of the current line is in or at the end of a multi-line string, fill the string or the paragraph of it that point is in, preserving the string's indentation. Optional argument JUSTIFY defines if the paragraph should be justified.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-fill-paragraph (&optional justify)
"`fill-paragraph-function' handling multi-line strings and possibly comments.
If any of the current line is in or at the end of a multi-line string,
fill the string or the paragraph of it that point is in, preserving
the string's indentation.
Optional argument JUSTIFY defines if the paragraph should be justified."
(interactive "P")
(save-excursion
(cond
;; Comments
((python-syntax-context 'comment)
(funcall python-fill-comment-function justify))
;; Strings/Docstrings
((python-info-triple-quoted-string-p)
(funcall python-fill-string-function justify))
;; Decorators
((equal (char-after (save-excursion
(python-nav-beginning-of-statement))) ?@)
(funcall python-fill-decorator-function justify))
;; Parens
((or (python-syntax-context 'paren)
(looking-at (python-rx open-paren))
(save-excursion
(skip-syntax-forward "^(" (line-end-position))
(looking-at (python-rx open-paren))))
(funcall python-fill-paren-function justify))
(t t))))