* 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)
"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)
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
;;; 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
;;; 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:
(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
(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
;;; 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:
(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
;;; 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
;;; 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
;;; 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
;;; 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
;;; 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:
(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 ()
;;; 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:
(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
(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
;;; 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
;; - 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.")
(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
;;; 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
;;; 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
(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
;;; 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
;;; 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:
(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)
;;; 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:
(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
;; 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
(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
(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
(_ (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))))
(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 "# ")
(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
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
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.")
(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
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
(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))