Skip to content

Inline treesit-query-p to ensure compatibility with Emacs 30 #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion clojure-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2472,14 +2472,20 @@ before DELIM-OPEN."
"v0.24.3"))
"Intended to be used as the value for `treesit-language-source-alist'.")

(defun clojure-ts--query-valid-p (query)
"Return non-nil if QUERY is valid in Clojure, nil otherwise."
(ignore-errors
(treesit-query-compile 'clojure query t)
t))

(defun clojure-ts--clojure-grammar-outdated-p ()
"Return TRUE if currently installed grammar is outdated.

This function checks if `clojure-ts-mode' is compatible with the
currently installed grammar. The simplest way to do this is to validate
a query that is valid in a previous grammar version but invalid in the
required version."
(treesit-query-valid-p 'clojure '((sym_lit (meta_lit)))))
(clojure-ts--query-valid-p '((sym_lit (meta_lit)))))

(defun clojure-ts--ensure-grammars ()
"Install required language grammars if not already available."
Expand Down