Function: c-ts-common--fill-paragraph

c-ts-common--fill-paragraph is an interactive and byte-compiled function defined in c-ts-common.el.gz.

Signature

(c-ts-common--fill-paragraph &optional ARG)

Documentation

Filling function for c-ts-common.

ARG is passed to fill-paragraph.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-common.el.gz
(defun c-ts-common--fill-paragraph (&optional arg)
  "Filling function for `c-ts-common'.
ARG is passed to `fill-paragraph'."
  (interactive "*P")
  (save-restriction
    (widen)
    (let ((node (treesit-node-at (point))))
      (when (string-match-p c-ts-common--comment-regexp
                            (treesit-node-type node))
        (if (or (save-excursion
                  (goto-char (treesit-node-start node))
                  (looking-at "//"))
                ;; In rust, NODE will be the body of a comment, and the
                ;; parent will be the whole comment.
                (if-let ((start (treesit-node-start
                                 (treesit-node-parent node))))
                    (save-excursion
                      (goto-char start)
                      (looking-at "//"))))
            (fill-comment-paragraph arg)
          (c-ts-common--fill-block-comment arg)))
      ;; Return t so `fill-paragraph' doesn't attempt to fill by
      ;; itself.
      t)))