Function: treesit-query-with-fallback

treesit-query-with-fallback is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-query-with-fallback LANGUAGE &rest QUERIES)

Documentation

Return the first valid query in QUERIES.

Return nil if no query is valid. Use LANGUAGE for validating queries.

View in manual

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-query-with-fallback (language &rest queries)
  "Return the first valid query in QUERIES.

Return nil if no query is valid.  Use LANGUAGE for validating queries."
  (declare (indent 1))
  (catch 'return
    (dolist (query queries)
      (ignore-errors
        (when (treesit--compile-query-with-cache language query)
          (throw 'return query))))
    nil))