[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a22730f4d78 01/10: Support COMMIT in treesit-language-source-alis
From: |
Yuan Fu |
Subject: |
master a22730f4d78 01/10: Support COMMIT in treesit-language-source-alist |
Date: |
Mon, 30 Dec 2024 03:24:09 -0500 (EST) |
branch: master
commit a22730f4d788d6476d5f3c6717ba8a3d4046e819
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Support COMMIT in treesit-language-source-alist
* lisp/treesit.el (treesit-language-source-alist): Add COMMIT
field.
(treesit--install-language-grammar-1): Support COMMIT.
---
lisp/treesit.el | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 50e510fa7db..090197d86e3 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -4090,14 +4090,16 @@ window."
The value should be an alist where each element has the form
- (LANG . (URL REVISION SOURCE-DIR CC C++))
+ (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
where the repository has been cloned.
-REVISION is the Git tag or branch of the desired version,
-defaulting to the latest default branch.
+REVISION is the Git tag or branch of the desired version, defaulting to
+the latest default branch. If COMMIT is non-nil, checkout this commit
+hash after cloning the repo. COMMIT has precedence over REVISION if
+both are non-nil.
SOURCE-DIR is the relative subdirectory in the repository in which
the grammar's parser.c file resides, defaulting to \"src\".
@@ -4266,7 +4268,8 @@ REVISION may be nil, in which case the cloned repo will
be at its
default branch.
Use shallow clone by default. Do a full clone when
-`treesit--install-language-grammar-full-clone' is t."
+`treesit--install-language-grammar-full-clone' is t. Do a blobless
+clone if `treesit--install-language-grammar-blobless' is t."
(message "Cloning repository")
;; git clone xxx --depth 1 --quiet [-b yyy] workdir
(let ((args (list "git" nil t nil "clone" url "--quiet")))
@@ -4280,7 +4283,7 @@ Use shallow clone by default. Do a full clone when
(apply #'treesit--call-process-signal args)))
(defun treesit--install-language-grammar-1
- (out-dir lang url &optional revision source-dir cc c++)
+ (out-dir lang url &optional revision source-dir cc c++ commit)
"Install and compile a tree-sitter language grammar library.
OUT-DIR is the directory to put the compiled library file. If it
@@ -4288,9 +4291,9 @@ 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++, see
-`treesit-language-source-alist'. If anything goes wrong, this
-function signals an error.
+For LANG, URL, REVISION, SOURCE-DIR, GRAMMAR-DIR, CC, C++, COMMIT, see
+`treesit-language-source-alist'. If anything goes wrong, this function
+signals an error.
Return the git revision of the installed grammar. The revision is
generated by \"git describe\". It only works when
@@ -4321,6 +4324,8 @@ generated by \"git describe\". It only works when
(when revision
(treesit--git-checkout-branch workdir revision))
(treesit--git-clone-repo url revision workdir))
+ (when commit
+ (treesit--git-checkout-branch workdir commit))
;; We need to go into the source directory because some
;; header files use relative path (#include "../xxx").
;; cd "${sourcedir}"
- master updated (dc653bf0636 -> ec3f9434c7d), Yuan Fu, 2024/12/30
- master 9e1e9fdff44 03/10: Refactor treesit-admin--verify-major-mode-queries, Yuan Fu, 2024/12/30
- master c9624c21117 05/10: Add treesit-admin--last-compatible-grammar-for-modes, Yuan Fu, 2024/12/30
- master d9cfe1fe92f 07/10: Add treesit-admin-generate-compatibility-report, Yuan Fu, 2024/12/30
- master a22730f4d78 01/10: Support COMMIT in treesit-language-source-alist,
Yuan Fu <=
- master d5ad51f25fb 04/10: Add treesit-admin--find-latest-compatible-revision, Yuan Fu, 2024/12/30
- master e2f79171529 02/10: Refactor treesit--install-language-grammar-1, Yuan Fu, 2024/12/30
- master 0b1986ba524 08/10: Generate compatibility report for multiple Emacs versions, Yuan Fu, 2024/12/30
- master 732a1108b0b 09/10: Add verified grammar version comment for tree-sitter modes, Yuan Fu, 2024/12/30
- master ec3f9434c7d 10/10: Make typescript-ts-mode work with latest grammar, Yuan Fu, 2024/12/30
- master 5ec170985f4 06/10: ; Move treesit-admin into tree-sitter directory, Yuan Fu, 2024/12/30