Function: treesit-outline--at-point

treesit-outline--at-point is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-outline--at-point)

Documentation

Return the outline heading node at the current line.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-outline--at-point ()
  "Return the outline heading node at the current line."
  (let* ((pred (if treesit-aggregated-outline-predicate
                   (alist-get (treesit-language-at (point))
                              treesit-aggregated-outline-predicate)
                 treesit-outline-predicate))
         (bol (pos-bol))
         (eol (pos-eol))
         (current (treesit-thing-at (point) pred))
         (current-valid (when current
                          (<= bol (treesit-node-start current) eol)))
         (next (unless current-valid
                 (treesit-navigate-thing (point) 1 'beg pred)))
         (next-valid (when next (<= bol next eol))))
    (or (and current-valid current)
        (and next-valid (treesit-thing-at next pred)))))