Function: treesit-thing-definition

treesit-thing-definition is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-thing-definition THING LANGUAGE)

Documentation

Return the predicate for THING if it's defined for LANGUAGE.

A thing is considered defined if it has an entry in treesit-thing-settings.

If LANGUAGE is nil, return the first definition for THING in treesit-thing-settings.

Other relevant functions are documented in the treesit group.

View in manual

Shortdoc

;; treesit
(treesit-thing-defined 'sexp)
    e.g. => (not (\, (rx (or "{" "}" "[" "]" "(" ")" ","))))

Aliases

treesit-thing-defined-p

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-thing-definition (thing language)
  "Return the predicate for THING if it's defined for LANGUAGE.
A thing is considered defined if it has an entry in
`treesit-thing-settings'.

If LANGUAGE is nil, return the first definition for THING in
`treesit-thing-settings'."
  (if language
      (car (alist-get thing (alist-get language
                                       treesit-thing-settings)))
    (car (alist-get thing (mapcan (lambda (entry)
                                    (copy-tree (cdr entry)))
                                  treesit-thing-settings)))))