Function: treesit-generic-mode-font-lock-query
treesit-generic-mode-font-lock-query is a byte-compiled function
defined in treesit-x.el.gz.
Signature
(treesit-generic-mode-font-lock-query LANG)
Documentation
Find the file highlights.scm and return its queries as a string.
Source Code
;; Defined in /usr/src/emacs/lisp/treesit-x.el.gz
(defun treesit-generic-mode-font-lock-query (lang)
"Find the file highlights.scm and return its queries as a string."
(let* ((file (expand-file-name
(format "queries/%s/highlights.scm" lang)
(locate-user-emacs-file "tree-sitter")))
(query (when (file-exists-p file)
(with-temp-buffer
(insert-file-contents file)
(buffer-substring-no-properties (point-min) (point-max))))))
(when query
(setq query (replace-regexp-in-string "(#set! [^)]+)" "" query nil nil))
(pcase-dolist (`(,from . ,to) treesit-generic-mode-font-lock-map)
(setq query (replace-regexp-in-string from to query nil t)))
query)))