]> git.eshelyaron.com Git - emacs.git/commitdiff
Use keyword :commit with full hashes for treesit-language-source-alist.
authorJuri Linkov <juri@linkov.net>
Fri, 20 Jun 2025 16:56:01 +0000 (19:56 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 22 Jun 2025 08:09:12 +0000 (10:09 +0200)
* lisp/treesit.el (treesit-language-source-alist):
Document the format that uses keywords.
(treesit--install-language-grammar-1): Remove args
'revision', 'source-dir', 'cc', 'c++', 'commit'.
Use 'args' to process the keywords, and use the remaining
list as the previous list of arguments.
(treesit--install-language-grammar-1): Let-bind
'treesit--install-language-grammar-full-clone' and
'treesit--install-language-grammar-blobless' to t
when 'commit' is non-nil (bug#78542).

* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/cmake-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/dockerfile-ts-mode.el:
* lisp/progmodes/elixir-ts-mode.el:
* lisp/progmodes/go-ts-mode.el:
* lisp/progmodes/heex-ts-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/rust-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/progmodes/typescript-ts-mode.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/html-ts-mode.el:
* lisp/textmodes/markdown-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
* lisp/textmodes/yaml-ts-mode.el:
Use the keyword :commit with full hashes instead of tags
in 'treesit-language-source-alist'.

* lisp/treesit-x.el (define-treesit-generic-mode):
Simplify the keyword :copy-queries.
(gitattributes-generic-ts-mode, liquid-generic-ts-mode):
Add keywords :commit and :copy-queries to :source.

* admin/tree-sitter/treesit-admin.el
(treesit-admin--unversioned-treesit-language-source-alist):
Handle :revision and :commit as well.
(treesit-admin--find-latest-compatible-revision):
Process the keywords in the recipe.

(cherry picked from commit 1a76b527ac35de179530249f5defc6646c96129e)

25 files changed:
admin/tree-sitter/treesit-admin.el
lisp/progmodes/c-ts-mode.el
lisp/progmodes/cmake-ts-mode.el
lisp/progmodes/csharp-mode.el
lisp/progmodes/dockerfile-ts-mode.el
lisp/progmodes/elixir-ts-mode.el
lisp/progmodes/go-ts-mode.el
lisp/progmodes/heex-ts-mode.el
lisp/progmodes/java-ts-mode.el
lisp/progmodes/js.el
lisp/progmodes/json-ts-mode.el
lisp/progmodes/lua-ts-mode.el
lisp/progmodes/php-ts-mode.el
lisp/progmodes/python.el
lisp/progmodes/ruby-ts-mode.el
lisp/progmodes/rust-ts-mode.el
lisp/progmodes/sh-script.el
lisp/progmodes/typescript-ts-mode.el
lisp/textmodes/css-mode.el
lisp/textmodes/html-ts-mode.el
lisp/textmodes/markdown-ts-mode.el
lisp/textmodes/toml-ts-mode.el
lisp/textmodes/yaml-ts-mode.el
lisp/treesit-x.el
lisp/treesit.el

index 1bb8b927e5c47203c50a4ccabdc3fc084126c5fe..8d9b9d7ec9a6abc159f6bc009244d8fa53ae83b2 100644 (file)
@@ -134,11 +134,21 @@ This is done by `require'ing all of the features that extend it."
   "Return a copy of treesit-language-source-alist, with any revisions removed."
   (mapcar
    (lambda (source)
-     (if (nthcdr 2 source)
-         (let ((unversioned-source (copy-sequence source)))
-           (setcar (nthcdr 2 unversioned-source) nil)
-           unversioned-source)
-       source))
+     (cond ((or (memq :revision source)
+                (memq :commit source))
+            (when (memq :revision source)
+              (let ((unversioned-source (copy-sequence source)))
+                (setcar (cdr (memq :revision unversioned-source)) nil)
+                unversioned-source))
+            (when (memq :commit source)
+              (let ((unversioned-source (copy-sequence source)))
+                (setcar (cdr (memq :commit unversioned-source)) nil)
+                unversioned-source)))
+           ((nthcdr 2 source)
+            (let ((unversioned-source (copy-sequence source)))
+              (setcar (nthcdr 2 unversioned-source) nil)
+              unversioned-source))
+           (t source)))
    (treesit-admin--populated-treesit-language-source-alist)))
 
 (defun treesit-admin--verify-major-mode-queries (modes source-alist grammar-dir)
@@ -343,8 +353,26 @@ epoch format."
         head-version version exit-code timestamp)
     (when (not recipe)
       (signal 'treesit-error `("Cannot find recipe" ,language)))
-    (pcase-let ((`(,url ,revision ,source-dir ,cc ,c++ ,commit)
-                 recipe))
+    (let ((url (pop recipe))
+          revision source-dir cc c++ commit copy-queries)
+
+      ;; Process the keywords.
+      (while (keywordp (car recipe))
+        (pcase (pop recipe)
+          (:revision     (setq revision     (pop recipe)))
+          (:source-dir   (setq source-dir   (pop recipe)))
+          (:cc           (setq cc           (pop recipe)))
+          (:c++          (setq c++          (pop recipe)))
+          (:commit       (setq commit       (pop recipe)))
+          (:copy-queries (setq copy-queries (pop recipe)))))
+
+      ;; Old positional convention for backward-compatibility.
+      (unless revision   (setq revision   (nth 0 recipe)))
+      (unless source-dir (setq source-dir (nth 1 recipe)))
+      (unless cc         (setq cc         (nth 2 recipe)))
+      (unless c++        (setq c++        (nth 3 recipe)))
+      (unless commit     (setq commit     (nth 4 recipe)))
+
       (with-temp-buffer
         (treesit--git-clone-repo url revision workdir)
         (when commit
index f63b71f89a315768481221cd51d607424848c4bf..7b40b4c73d3d67784088088c51d4a900de85a1d4 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; c-ts-mode is known to work with the following languages and version:
+;; c-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-c: v0.23.4-1-g3aa2995
 ;;
-;; c++-ts-mode is known to work with the following languages and version:
+;; c++-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 (add-to-list
  'treesit-language-source-alist
- '(c "https://github.com/tree-sitter/tree-sitter-c" "v0.23.4")
+ '(c "https://github.com/tree-sitter/tree-sitter-c"
+     :commit "3aa2995549d5d8b26928e8d3fa2770fd4327414e")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(cpp "https://github.com/tree-sitter/tree-sitter-cpp" "v0.23.4")
+ '(cpp "https://github.com/tree-sitter/tree-sitter-cpp"
+       :commit "f41b4f66a42100be405f96bdc4ebc4a61095d3e8")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(doxygen "https://github.com/tree-sitter-grammars/tree-sitter-doxygen" "v1.1.0")
+ '(doxygen "https://github.com/tree-sitter-grammars/tree-sitter-doxygen"
+           :commit "1e28054cb5be80d5febac082706225e42eff14e6")
  t)
 
 ;;; Custom variables
index d5008fcc10253013eefeda9be1b14bfca9361422..2f2d1b6e2a0be3652ead4b25f51bb470d0e981ec 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; cmake-ts-mode is known to work with the following languages and version:
+;; cmake-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-cmake: v0.5.0-5-ge409ae3
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
@@ -42,7 +42,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(cmake "https://github.com/uyha/tree-sitter-cmake" "v0.5.0")
+ '(cmake "https://github.com/uyha/tree-sitter-cmake"
+         :commit "e409ae33f00e04cde30f2bcffb979caf1a33562a")
  t)
 
 (defcustom cmake-ts-mode-indent-offset 2
index bec94eed35c4e794becaddd0478d6ba9afb1a284..958ccf05672ed46dd700a59ee2bfb02d331fe17a 100644 (file)
@@ -651,7 +651,8 @@ compilation and evaluation time conflicts."
 
 (add-to-list
  'treesit-language-source-alist
- '(c-sharp "https://github.com/tree-sitter/tree-sitter-c-sharp" "v0.23.1")
+ '(c-sharp "https://github.com/tree-sitter/tree-sitter-c-sharp"
+           :commit "362a8a41b265056592a0c3771664a21d23a71392")
  t)
 
 (defcustom csharp-ts-mode-indent-offset 4
index 5dcc5704c34c3a37fd55cb2eece0d9102887d6a6..fe0c9e23accfdee3e2b4bb92d2e520f67bb0c2e9 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; dockerfile-ts-mode is known to work with the following languages and version:
+;; dockerfile-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-dockerfile: v0.2.0-1-g087daa2
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
@@ -42,7 +42,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile" "v0.2.0")
+ '(dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile"
+              :commit "087daa20438a6cc01fa5e6fe6906d77c869d19fe")
  t)
 
 (defvar dockerfile-ts-mode--syntax-table
index d1a78ca10188736c43df8c8e59fe65cfa9e80886..8b43c0324248af9cbdfc489d2010e11b223ac356 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; elixir-ts-mode is known to work with the following languages and version:
-;; - tree-sitter-heex: v0.7.0
+;; elixir-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-elixir: v0.3.3
+;; - tree-sitter-heex: v0.7.0
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 (add-to-list
  'treesit-language-source-alist
- '(elixir "https://github.com/elixir-lang/tree-sitter-elixir" "v0.3.3")
+ '(elixir "https://github.com/elixir-lang/tree-sitter-elixir"
+          :commit "02a6f7fd4be28dd94ee4dd2ca19cb777053ea74e")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(heex "https://github.com/phoenixframework/tree-sitter-heex" "v0.7.0")
+ '(heex "https://github.com/phoenixframework/tree-sitter-heex"
+        :commit "f6b83f305a755cd49cf5f6a66b2b789be93dc7b9")
  t)
 
 (defgroup elixir-ts nil
index 79ad8a2fafd62cb91d5dbc0df8b6967c0149bb95..db609b92767e7e4b463e54bed6fded610fa955c4 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; go-ts-mode is known to work with the following languages and version:
+;; go-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-go: v0.23.4-1-g12fe553
 ;; - tree-sitter-go-mod: v1.1.0-3b01edce
 ;; - tree-sitter-go-work: 949a8a47
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 (add-to-list
  'treesit-language-source-alist
- '(go "https://github.com/tree-sitter/tree-sitter-go" "v0.23.4")
+ '(go "https://github.com/tree-sitter/tree-sitter-go"
+      :commit "12fe553fdaaa7449f764bc876fd777704d4fb752")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(gomod "https://github.com/camdencheek/tree-sitter-go-mod" "v1.1.0")
+ '(gomod "https://github.com/camdencheek/tree-sitter-go-mod"
+         :commit "3b01edce2b9ea6766ca19328d1850e456fde3103")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(gowork "https://github.com/omertuc/tree-sitter-go-work")
+ '(gowork "https://github.com/omertuc/tree-sitter-go-work"
+          :commit "949a8a470559543857a62102c84700d291fc984c")
  t)
 
 (defcustom go-ts-mode-indent-offset 8
index 08c9019e6bc28ff06df078f8acaa6adedd8314a5..c478750a73ece59f013b9783059d332b6fb7ec8a 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; heex-ts-mode is known to work with the following languages and version:
+;; heex-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-heex: v0.7.0
+;; - tree-sitter-elixir: v0.3.3
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 (add-to-list
  'treesit-language-source-alist
- '(heex "https://github.com/phoenixframework/tree-sitter-heex" "v0.7.0")
+ '(heex "https://github.com/phoenixframework/tree-sitter-heex"
+        :commit "f6b83f305a755cd49cf5f6a66b2b789be93dc7b9")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(elixir "https://github.com/elixir-lang/tree-sitter-elixir" "v0.3.3")
+ '(elixir "https://github.com/elixir-lang/tree-sitter-elixir"
+          :commit "02a6f7fd4be28dd94ee4dd2ca19cb777053ea74e")
  t)
 
 (defgroup heex-ts nil
index 96ef6447f9b05d3f3fffb9a81aded039bd5fd1e4..10692387b9d0cc04ca49b7f539b0c93c87873213 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; java-ts-mode is known to work with the following languages and version:
+;; java-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-java: v0.23.5
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 (add-to-list
  'treesit-language-source-alist
- '(java "https://github.com/tree-sitter/tree-sitter-java" "v0.23.5")
+ '(java "https://github.com/tree-sitter/tree-sitter-java"
+        :commit "94703d5a6bed02b98e438d7cad1136c01a60ba2c")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(doxygen "https://github.com/tree-sitter-grammars/tree-sitter-doxygen" "v1.1.0")
+ '(doxygen "https://github.com/tree-sitter-grammars/tree-sitter-doxygen"
+           :commit "1e28054cb5be80d5febac082706225e42eff14e6")
  t)
 
 (defcustom java-ts-mode-indent-offset 4
index cc09c92f49bac664bf08d82a6b2973f7466cc97a..ec7c2602d331f665ae3b29c2b766da50a3d1a477 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; js-ts-mode is known to work with the following languages and version:
+;; js-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-jsdoc: v0.23.2
 ;; - tree-sitter-javascript: v0.23.1-2-g108b2d4
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
@@ -3410,11 +3410,13 @@ This function is intended for use in `after-change-functions'."
 
 (add-to-list
  'treesit-language-source-alist
- '(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.1")
+ '(javascript "https://github.com/tree-sitter/tree-sitter-javascript"
+              :commit "108b2d4d17a04356a340aea809e4dd5b801eb40d")
  t)
 (add-to-list
  'treesit-language-source-alist
- '(jsdoc "https://github.com/tree-sitter/tree-sitter-jsdoc" "v0.23.2")
+ '(jsdoc "https://github.com/tree-sitter/tree-sitter-jsdoc"
+         :commit "b253abf68a73217b7a52c0ec254f4b6a7bb86665")
  t)
 
 (defun js--treesit-font-lock-compatibility-definition-feature ()
index 11ec5d5c079bda64fa7481ee3b90b9d812967b7a..a18f3c342c0cf586ddc36add7c96522ea16886b8 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; json-ts-mode is known to work with the following languages and version:
+;; json-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-json: v0.24.8-1-g4d770d3
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
@@ -42,7 +42,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(json "https://github.com/tree-sitter/tree-sitter-json" "v0.24.8")
+ '(json "https://github.com/tree-sitter/tree-sitter-json"
+        :commit "4d770d31f732d50d3ec373865822fbe659e47c75")
  t)
 
 (defcustom json-ts-mode-indent-offset 2
index 4bc619d8fbf4aaa54e6fbc2b9cf664ee8375b5c2..b8bcf076e333edf48b8bec8daac20d2df61703ca 100644 (file)
@@ -50,7 +50,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(lua "https://github.com/tree-sitter-grammars/tree-sitter-lua" "v0.3.0")
+ '(lua "https://github.com/tree-sitter-grammars/tree-sitter-lua"
+       :commit "db16e76558122e834ee214c8dc755b4a3edc82a9")
  t)
 
 (defgroup lua-ts nil
index 46217473fe6d5bf099d05ee8adab498761695948..567f0bdce745426709b843ec73c1f1165eff5a2e 100644 (file)
@@ -24,8 +24,8 @@
 
 ;;; Tree-sitter language versions
 ;;
-;; php-ts-mode is known to work with the following languages and version:
-;; - tree-sitter-phpdoc: fe3202e468bc17332bec8969f2b50ff1f1da3a46
+;; php-ts-mode has been tested with the following grammars and version:
+;; - tree-sitter-phpdoc: v0.1.5
 ;; - tree-sitter-css: v0.23.1-1-g6a442a3
 ;; - tree-sitter-jsdoc: v0.23.2
 ;; - tree-sitter-javascript: v0.23.1-2-g108b2d4
@@ -33,7 +33,7 @@
 ;; - tree-sitter-php: v0.23.11
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 ;;; Install treesitter language parsers
 (defvar php-ts-mode--language-source-alist
-  '((php "https://github.com/tree-sitter/tree-sitter-php" "v0.23.11" "php/src")
-    (phpdoc "https://github.com/claytonrcarter/tree-sitter-phpdoc"))
+  '((php "https://github.com/tree-sitter/tree-sitter-php"
+         :commit "43aad2b9a98aa8e603ea0cf5bb630728a5591ad8"
+         :source-dir "php/src")
+    (phpdoc "https://github.com/claytonrcarter/tree-sitter-phpdoc"
+            :commit "fe3202e468bc17332bec8969f2b50ff1f1da3a46"))
   "Treesitter language parsers required by `php-ts-mode'.
 You can customize `treesit-language-source-alist' if you want
 to stick to a specific commit and/or use different parsers.")
index e6252de4420e072955be14e2d16ac2e103e7b622..664c00243a9528a6ece105ec74477d1392494457 100644 (file)
 
 (add-to-list
  'treesit-language-source-alist
- '(python "https://github.com/tree-sitter/tree-sitter-python" "v0.23.6")
+ '(python "https://github.com/tree-sitter/tree-sitter-python"
+          :commit "bffb65a8cfe4e46290331dfef0dbf0ef3679de11")
  t)
 
 ;; Avoid compiler warnings
index 30882f055d37a418e26d3653bb6c75a57f4ed760..c235977084fb87794195843105578fff8e2e0eaa 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; ruby-ts-mode is known to work with the following languages and version:
+;; ruby-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-ruby: v0.23.1
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 
 (add-to-list
  'treesit-language-source-alist
- '(ruby "https://github.com/tree-sitter/tree-sitter-ruby" "v0.23.1")
+ '(ruby "https://github.com/tree-sitter/tree-sitter-ruby"
+        :commit "71bd32fb7607035768799732addba884a37a6210")
  t)
 
 (defgroup ruby-ts nil
index 5ae4921287ecdac849b023af161fc86ff092bf4b..6090fcb9c68aea22a0643d3d80dfba8b7fbdf1d7 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; rust-ts-mode is known to work with the following languages and version:
-;; - tree-sitter-rust: v0.23.2-1-g1f63b33
+;; rust-ts-mode has been tested with the following grammars and version:
+;; - tree-sitter-rust: v0.24.0
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 (add-to-list
  'treesit-language-source-alist
  `(rust "https://github.com/tree-sitter/tree-sitter-rust"
-        ,(when (treesit-available-p)
-           (if (< (treesit-library-abi-version) 15) "v0.23.2" "v0.24.0")))
+        :commit ,(if (and (treesit-available-p)
+                          (< (treesit-library-abi-version) 15))
+                     "1f63b33efee17e833e0ea29266dd3d713e27e321"
+                   "18b0515fca567f5a10aee9978c6d2640e878671a"))
  t)
 
 (defcustom rust-ts-mode-indent-offset 4
index 6a4da659d459e88d7d4e5b1c1ed61824d8763e5b..589e4c80d2b8738289a57666b0b0e6bf97314fc1 100644 (file)
@@ -3284,7 +3284,8 @@ member of `flymake-diagnostic-functions'."
 
 (add-to-list
  'treesit-language-source-alist
- '(bash "https://github.com/tree-sitter/tree-sitter-bash" "v0.23.3")
+ '(bash "https://github.com/tree-sitter/tree-sitter-bash"
+        :commit "487734f87fd87118028a65a4599352fa99c9cde8")
  t)
 
 (defvar sh-mode--treesit-operators
index 6aa64706d3c639c6927db9604d6249050c321c94..1a2ef2e237f4bdcbeaedec1f5531369de775f742 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; typescript-ts-mode is known to work with the following languages and version:
+;; typescript-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-typescript: v0.23.2-2-g8e13e1d
 ;;
+;; tsx-ts-mode has been tested with the following grammars and version:
+;; - tree-sitter-tsx: v0.23.2-2-g8e13e1d
+;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
 (add-to-list
  'treesit-language-source-alist
  '(typescript
-   "https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2"
-   "typescript/src")
+   "https://github.com/tree-sitter/tree-sitter-typescript"
+   :commit "8e13e1db35b941fc57f2bd2dd4628180448c17d5"
+   :source-dir "typescript/src")
  t)
 (add-to-list
  'treesit-language-source-alist
  '(tsx
-   "https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2"
-   "tsx/src")
+   "https://github.com/tree-sitter/tree-sitter-typescript"
+   :commit "8e13e1db35b941fc57f2bd2dd4628180448c17d5"
+   :source-dir "tsx/src")
  t)
 
 (defcustom typescript-ts-mode-indent-offset 2
index fec92d07adcb104ed514170a0404d4373f4ada0f..d0c03a606a73ec95311fa896d4c089fbff3c31cc 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; css-ts-mode is known to work with the following languages and version:
+;; css-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-css: v0.23.1-1-g6a442a3
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
@@ -1343,7 +1343,8 @@ for determining whether point is within a selector."
 
 (add-to-list
  'treesit-language-source-alist
- '(css "https://github.com/tree-sitter/tree-sitter-css" "v0.23.1")
+ '(css "https://github.com/tree-sitter/tree-sitter-css"
+       :commit "6a442a3cf461b0ce275339e5afa178693484c927")
  t)
 
 (defvar css-ts-mode-map (copy-keymap css-mode-map)
index 15d419b1a3754104b98db4084755df2329ea22b3..1bf89ee8f4e55d8a05e82db1a174fc5e044775bb 100644 (file)
 
 ;;; Tree-sitter language versions
 ;;
-;; html-ts-mode is known to work with the following languages and version:
+;; html-ts-mode has been tested with the following grammars and version:
 ;; - tree-sitter-html: v0.23.2-1-gd9219ad
 ;;
 ;; We try our best to make builtin modes work with latest grammar
-;; versions, so a more recent grammar version has a good chance to work.
+;; versions, so a more recent grammar has a good chance to work too.
 ;; Send us a bug report if it doesn't.
 
 ;;; Commentary:
@@ -45,7 +45,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(html "https://github.com/tree-sitter/tree-sitter-html" "v0.23.2")
+ '(html "https://github.com/tree-sitter/tree-sitter-html"
+        :commit "d9219ada6e1a2c8f0ab0304a8bd9ca4285ae0468")
  t)
 
 (defcustom html-ts-mode-indent-offset 2
index c7a32d07a89a9a088e3f875219cf74053158ccdf..3398ba7bf5c97b3fe490c96ba326195e6bd251bf 100644 (file)
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
+;;; Tree-sitter language versions
+;;
+;; markdown-ts-mode has been tested with the following grammars and version:
+;; - tree-sitter-markdown: v0.4.1
+;; - tree-sitter-markdown-inline: v0.4.1
+;;
+;; We try our best to make builtin modes work with latest grammar
+;; versions, so a more recent grammar has a good chance to work too.
+;; Send us a bug report if it doesn't.
+
 ;;; Commentary:
 ;;
 
 (add-to-list
  'treesit-language-source-alist
  '(markdown
-   "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "v0.4.1"
-   "tree-sitter-markdown/src")
+   "https://github.com/tree-sitter-grammars/tree-sitter-markdown"
+   :commit "413285231ce8fa8b11e7074bbe265b48aa7277f9"
+   :source-dir "tree-sitter-markdown/src")
  t)
 (add-to-list
  'treesit-language-source-alist
  '(markdown-inline
-   "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "v0.4.1"
-   "tree-sitter-markdown-inline/src")
+   "https://github.com/tree-sitter-grammars/tree-sitter-markdown"
+   :commit "413285231ce8fa8b11e7074bbe265b48aa7277f9"
+   :source-dir "tree-sitter-markdown-inline/src")
  t)
 
 ;;; Helper functions
index 854ff93fd6b59b54c59e16a6c4d23feb0140bea8..c1c5dea2bd94747027e559c6b06940f51f4adead 100644 (file)
@@ -38,7 +38,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(toml "https://github.com/tree-sitter-grammars/tree-sitter-toml" "v0.7.0")
+ '(toml "https://github.com/tree-sitter-grammars/tree-sitter-toml"
+        :commit "64b56832c2cffe41758f28e05c756a3a98d16f41")
  t)
 
 (defcustom toml-ts-mode-indent-offset 2
index 6bd1bd946ae898b38764eae925ea7f8a52aad651..58ed06de8860dd9b5ef83d423061244f8c068429 100644 (file)
@@ -37,7 +37,8 @@
 
 (add-to-list
  'treesit-language-source-alist
- '(yaml "https://github.com/tree-sitter-grammars/tree-sitter-yaml" "v0.7.0")
+ '(yaml "https://github.com/tree-sitter-grammars/tree-sitter-yaml"
+        :commit "b733d3f5f5005890f324333dd57e1f0badec5c87")
  t)
 
 (defvar yaml-ts-mode--syntax-table
index d13d6b1a35aba992a655e654d2547308e7c4d09d..65845ed0ac072cd0d875b147e56263d5d994fb2d 100644 (file)
@@ -110,7 +110,7 @@ of `define-treesit-generic-mode'.
         (_ (pop body))))
 
     (when (stringp source)
-      (setq source (list 'quote (list source nil nil nil nil nil :copy-queries t))))
+      (setq source (list 'quote (list source :copy-queries t))))
     (when (stringp auto-mode)
       (setq auto-mode (list 'quote (ensure-list auto-mode))))
 
@@ -203,7 +203,9 @@ of `define-treesit-generic-mode'.
 (define-treesit-generic-mode gitattributes-generic-ts-mode
   "Tree-sitter generic mode for .gitattributes files."
   :lang 'gitattributes
-  :source "https://github.com/tree-sitter-grammars/tree-sitter-gitattributes"
+  :source '("https://github.com/tree-sitter-grammars/tree-sitter-gitattributes"
+            :commit "5425944fd61bf2b3bad2c17c2dc9f53172b0f01d"
+            :copy-queries t)
   :auto-mode "gitattributes\\'"
   :name "Git-Attributes"
   (setq-local comment-start "# ")
@@ -212,7 +214,9 @@ of `define-treesit-generic-mode'.
 (define-treesit-generic-mode liquid-generic-ts-mode
   "Tree-sitter generic mode for Liquid templates."
   :lang 'liquid
-  :source "https://github.com/hankthetank27/tree-sitter-liquid"
+  :source '("https://github.com/hankthetank27/tree-sitter-liquid"
+            :commit "d6ebde3974742cd1b61b55d1d94aab1dacb41056"
+            :copy-queries t)
   :auto-mode "\\.liquid\\'"
   :name "Liquid"
   :parent 'mhtml-ts-mode
index 14979f07887da7a0ebef57c1f0388f8369e1d44a..a9da0fa3a36e2ddb38e102e9f45b740a0a75c887 100644 (file)
@@ -4991,7 +4991,7 @@ window."
 
 The value should be an alist where each element has the form
 
-    (LANG . (URL REVISION SOURCE-DIR CC C++ COMMIT [KEYWORD VALUE]...))
+    (LANG . (URL REVISION SOURCE-DIR CC C++ COMMIT))
 
 Only LANG and URL are mandatory.  LANG is the language symbol.
 URL is the URL of the grammar's Git repository or a directory
@@ -5008,8 +5008,17 @@ the grammar's parser.c file resides, defaulting to \"src\".
 CC and C++ are C and C++ compilers, defaulting to \"cc\" and
 \"c++\", respectively.
 
+Another way to specify optional data is to use keywords:
+
+    (LANG . (URL [KEYWORD VALUE]...))
+
 The currently supported keywords:
 
+`:revision' is the same as REVISION above.
+`:source-dir' is the same as SOURCE-DIR above.
+`:cc' is the same as CC above.
+`:c++' is the same as C++ above.
+`:commit' is the same as COMMIT above.
 `:copy-queries' when non-nil specifies whether to copy the files
 in the \"queries\" directory from the source directory to the
 installation directory.")
@@ -5194,7 +5203,7 @@ clone if `treesit--install-language-grammar-blobless' is t."
     (apply #'treesit--call-process-signal args)))
 
 (defun treesit--install-language-grammar-1
-    (out-dir lang url &optional revision source-dir cc c++ commit &rest args)
+    (out-dir lang url &rest args)
   "Compile and install a tree-sitter language grammar library.
 
 OUT-DIR is the directory to put the compiled library file.  If it
@@ -5202,8 +5211,7 @@ is nil, the \"tree-sitter\" directory under user's Emacs
 configuration directory is used (and automatically created if it
 does not exist).
 
-For LANG, URL, REVISION, SOURCE-DIR, GRAMMAR-DIR, CC, C++, COMMIT, see
-`treesit-language-source-alist'.
+For ARGS, see `treesit-language-source-alist'.
 
 Return the git revision of the installed grammar.  The revision is
 generated by \"git describe\".  It only works when
@@ -5216,20 +5224,38 @@ If anything goes wrong, this function signals an `treesit-error'."
          (workdir (if url-is-dir
                       maybe-repo-dir
                     (expand-file-name "repo")))
-         copy-queries version)
+         version
+         revision source-dir cc c++ commit copy-queries)
 
     ;; Process the keyword args.
     (while (keywordp (car args))
       (pcase (pop args)
-        (:copy-queries (setq copy-queries (pop args)))
-        (_ (pop args))))
+        (:revision     (setq revision     (pop args)))
+        (:source-dir   (setq source-dir   (pop args)))
+        (:cc           (setq cc           (pop args)))
+        (:c++          (setq c++          (pop args)))
+        (:commit       (setq commit       (pop args)))
+        (:copy-queries (setq copy-queries (pop args)))))
+
+    ;; Old positional convention for backward-compatibility.
+    (unless revision   (setq revision   (nth 0 args)))
+    (unless source-dir (setq source-dir (nth 1 args)))
+    (unless cc         (setq cc         (nth 2 args)))
+    (unless c++        (setq c++        (nth 3 args)))
+    (unless commit     (setq commit     (nth 4 args)))
 
     (unwind-protect
         (with-temp-buffer
           (if url-is-dir
               (when revision
                 (treesit--git-checkout-branch workdir revision))
-            (treesit--git-clone-repo url revision workdir))
+            (if commit
+                ;; Force blobless full clone to be able later
+                ;; to checkout a commit (bug#78542).
+                (let ((treesit--install-language-grammar-full-clone t)
+                      (treesit--install-language-grammar-blobless t))
+                  (treesit--git-clone-repo url revision workdir))
+              (treesit--git-clone-repo url revision workdir)))
           (when commit
             (treesit--git-checkout-branch workdir commit))
           (setq version (treesit--language-git-revision workdir))