Function: tuareg--fill-comment
tuareg--fill-comment is a natively compiled function defined in
tuareg.el.
Signature
(tuareg--fill-comment)
Documentation
Assumes the point is inside a comment and justify it.
This function moves the point.
Source Code
;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg.el
(defun tuareg--fill-comment ()
"Assumes the point is inside a comment and justify it.
This function moves the point."
(let* ((com-start (nth 8 (syntax-ppss)))
content-start
com-end
in-doc-comment
par-start
par-end)
(save-excursion
(goto-char com-start)
(setq content-start (and (looking-at comment-start-skip)
(match-end 0)))
(setq in-doc-comment (looking-at-p (rx "(**" (not (in "*")))))
(forward-comment 1)
(setq com-end (point)))
;; In doc comments, let @tags start a paragraph.
(let ((paragraph-start
(if in-doc-comment
(concat paragraph-start
"\\|"
(rx (* (in " \t")) "@" (+ lower) symbol-end))
paragraph-start)))
(save-restriction
(narrow-to-region content-start com-end)
(save-excursion
(skip-chars-forward " \t")
(backward-paragraph)
(skip-chars-forward " \t\n")
(setq par-start (point))
(forward-paragraph)
(setq par-end (point))))
;; Set `fill-prefix' to preserve the indentation of the start of the
;; paragraph, assuming that is what the user wants.
(let ((fill-prefix
(save-excursion
(goto-char par-start)
(let ((col
(if (and in-doc-comment
(looking-at-p
(rx "@" (+ lower) symbol-end)))
;; Indent two spaces under @tag.
(+ 2 (current-column))
(current-column))))
(make-string col ?\s)))))
(fill-region-as-paragraph par-start par-end)))))