fix(:lang): add treesit-available-p checks to *-ts-mode packages

Otherwise package installation will throw Emacs version errors for users
on 28 and under.
This commit is contained in:
Henrik Lissner
2025-09-01 18:37:33 +02:00
parent 84e8ae58d1
commit a51690f033
18 changed files with 23 additions and 21 deletions

View File

@@ -9,7 +9,7 @@
(package! opencl-mode :pin "204d5d9e0f5cb2cbe810f2933230eb08fe2c7695")
(when (package! cuda-mode :pin "c3dae31b3d1abedf4d0b98840127e2cac73d6ad8")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! cuda-ts-mode
:recipe (:host github :repo "Ergus/cuda-ts-mode")
:pin "807f15150deb3a3060bc36a0e135a27876d7e239")))

View File

@@ -15,7 +15,7 @@
;;; Core packages
(package! clojure-mode :pin "b766094aea28bdc7b44ce1960d96434fe7d1d9cf")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! clojure-ts-mode :pin "da56a6938f525c8ead1fb3d79eced4d892df1661"))
(package! clj-refactor :pin "dc1bbc8cdaa723bdbb6669ea7d280625c370755d")
(package! cider :pin "12f10a6f4b3052a9b437f92cf97d551a5964f4cb")

View File

@@ -3,7 +3,7 @@
(package! dart-mode :pin "f82ff052309125b93d19bdd3f619266f908f43ce")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! dart-ts-mode
:recipe (:host github
:repo "50ways2sayhard/dart-ts-mode")

View File

@@ -3,5 +3,5 @@
(package! erlang :pin "b9d3ec017da091168918a2901a1cef4cb062fd2a")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! erlang-ts :pin "eb579dd55fbb2cf721290939e7b3a50be19c0305"))

View File

@@ -7,5 +7,5 @@
(package! company-graphql
:recipe (:host github :repo "thaenalpha/company-graphql")
:pin "aed9f5109e877944a895d08fc08bad103f03096b"))
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! graphql-ts-mode :pin "e933f235408ea195762700fd07c2d828e8f09aac"))

View File

@@ -2,7 +2,7 @@
;;; lang/haskell/packages.el
(package! haskell-mode :pin "e9c356739310332afe59b10ffa2e6c3e76f124e3")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! haskell-ts-mode :pin "b47211699944997bfb03fd88b1157dd71727bad7"))
(when (and (modulep! +lsp)

View File

@@ -5,7 +5,7 @@
:recipe (:files ("*.el"))
:pin "9e3254a0249d720d5fa5603f1f8c3ed0612695af")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! janet-ts-mode
:recipe (:host github :repo "sogaiu/janet-ts-mode")
:pin "ac684edf57e4d4e085cf99d5ad2ee084b46b8123"))

View File

@@ -4,7 +4,7 @@
(package! julia-mode :pin "5c940c4ba357d8361534f11169f3d40b2d7833fc")
(package! julia-repl :pin "317d56021889a336b4be241604ba71e46dc80581")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! julia-ts-mode :pin "d693c6b35d3aed986b2700a3b5f910de12d6c53c"))
(when (modulep! +lsp)

View File

@@ -3,8 +3,7 @@
(package! kotlin-mode :pin "fddd747e5b4736e8b27a147960f369b86179ddff")
(when (and (modulep! +tree-sitter)
(fboundp 'treesit-available-p))
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! kotlin-ts-mode :pin "a25d56cecac9160ba7c140f982ec16ca7b2fe97f"))
(when (modulep! :checkers syntax -flymake)

View File

@@ -8,7 +8,7 @@
;; present when you call `markdown-edit-code-block'.
(package! edit-indirect :pin "82a28d8a85277cfe453af464603ea330eae41c05")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! markdown-ts-mode
:built-in 'prefer ; Emacs 31+ has a superior markdown-ts-mode
:pin "2f1ee8b94cdf53cebc31ae08ecfbba846193d5e1"))

View File

@@ -4,8 +4,7 @@
(package! nix-mode :pin "719feb7868fb567ecfe5578f6119892c771ac5e5")
(package! nix-update :pin "77022ccd918d665acbb519b243e7e3dc5eae1c47")
(when (and (modulep! +tree-sitter)
(fboundp 'treesit-available-p))
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! nix-ts-mode :pin "62ce3a2dc39529c5db3516427e84b2c96b8efcfd"))
(when (modulep! :completion company)

View File

@@ -5,7 +5,7 @@
(modulep! :tools lsp))
"This module requires (:tools lsp)")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(assert! (modulep! :tools tree-sitter)
"This module requires (:tools tree-sitter)")
(assert! (fboundp 'php-ts-mode)

View File

@@ -4,7 +4,7 @@
(package! qml-mode :pin "6c5f33ba88ae010bf201a80ee8095e20a724558c")
(package! qt-pro-mode :pin "7a2da323de834294b413cbbb3c92f42f54913643")
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! qml-ts-mode
:recipe (:host github
:repo "xhcoding/qml-ts-mode")

View File

@@ -4,8 +4,7 @@
(package! sbt-mode :pin "cc68728a6ef0600aad369157b3a2d0ce56afba9b")
(package! scala-mode :pin "661337d8aa0a0cb418184c83757661603de3b2e3")
(when (and (modulep! +tree-sitter)
(fboundp 'treesit-available-p))
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! scala-ts-mode :pin "c7671e10419261ef70b1820d3b970ad39f6fcfe2"))
(when (and (modulep! +lsp)

View File

@@ -6,5 +6,5 @@
(package! company-mlton
:recipe (:host github :repo "MatthewFluet/company-mlton" :files ("*.el" "*.basis"))
:pin "9b09d209b4767a2af24784fb5321390ed1d445bf"))
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! sml-ts-mode :pin "d2dabcc9d8f91eeee7048641e4c80fabb3583194"))

View File

@@ -11,5 +11,5 @@
(when (modulep! :checkers syntax -flymake)
(package! flycheck-swift :pin "4c5ad401252400a78da395fd56a71e67ff8c2761")))
(when (modulep! +tree-sitter)
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! swift-ts-mode :pin "43a0be79f9758fc444f5fafdff6023c4c7bf80f7"))

View File

@@ -3,6 +3,5 @@
(package! zig-mode :pin "c46d024733b7c1d6af829bb610fc9629b060bc9e")
(when (and (modulep! +tree-sitter)
(fboundp 'treesit-available-p))
(when (and (modulep! +tree-sitter) (treesit-available-p))
(package! zig-ts-mode :pin "3898b70d6f72da688e086323fa2922f1542d1318"))

View File

@@ -7,6 +7,12 @@
(autoload 'treesit-ready-p "treesit")
;;;###autoload
(unless (fboundp 'treesit-available-p)
(defun treesit-available-p ()
"Return non-nil if tree-sitter support is built-in and available."
nil))
;;;###autoload
(defcustom treesit-auto-install-grammar 'ask
"Whether to install tree-sitter language grammar libraries when needed.