Function: treesit-forward-comment

treesit-forward-comment is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-forward-comment &optional COUNT)

Documentation

Tree-sitter forward-comment-function implementation.

COUNT is the same as in forward-comment.

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-forward-comment (&optional count)
  "Tree-sitter `forward-comment-function' implementation.

COUNT is the same as in `forward-comment'."
  (let ((res t) thing)
    (while (> count 0)
      (skip-chars-forward " \t\n")
      (setq thing (treesit-thing-at (point) 'comment))
      (if (and thing (eq (point) (treesit-node-start thing)))
          (progn
            (goto-char (min (1+ (treesit-node-end thing)) (point-max)))
            (setq count (1- count)))
        (setq count 0 res nil)))
    (while (< count 0)
      (skip-chars-backward " \t\n")
      (setq thing (treesit-thing-at (max (1- (point)) (point-min)) 'comment))
      (if (and thing (eq (point) (treesit-node-end thing)))
          (progn
            (goto-char (treesit-node-start thing))
            (setq count (1+ count)))
        (setq count 0 res nil)))
    res))