Function: lua--fill-paragraph

lua--fill-paragraph is a byte-compiled function defined in lua-mode.el.gz.

Signature

(lua--fill-paragraph &optional JUSTIFY REGION)

Documentation

Implementation of forward-paragraph for filling.

This function works around a corner case in the following situations:

    <>
    -- some very long comment ....
    some_code_right_after_the_comment

If point is at the beginning of the comment line, fill paragraph code would have gone for comment-based filling and done the right thing, but it does not find a comment at the beginning of the empty line before the comment and falls back to text-based filling ignoring comment-start and spilling the comment into the code.

The arguments JUSTIFY and REGION control fill-paragraph (which see).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
;; Private functions

(defun lua--fill-paragraph (&optional justify region)
  "Implementation of `forward-paragraph' for filling.

This function works around a corner case in the following situations:

    <>
    -- some very long comment ....
    some_code_right_after_the_comment

If point is at the beginning of the comment line, fill paragraph code
would have gone for comment-based filling and done the right thing, but
it does not find a comment at the beginning of the empty line before the
comment and falls back to text-based filling ignoring `comment-start'
and spilling the comment into the code.

The arguments JUSTIFY and REGION control `fill-paragraph' (which see)."
  (save-excursion
    (while (and (not (eobp))
                (progn (move-to-left-margin)
                       (looking-at paragraph-separate)))
      (forward-line 1))
    (let ((fill-paragraph-handle-comment t))
      (fill-paragraph justify region))))