; Remove GRAMMAR-DIR from treesit-language-source-alist

Removing it doesn't affect building all the language grammars in
batch.sh, so it must be an artifact I added for something else and
later forgot to remove.

* lisp/treesit.el (treesit-language-source-alist)
(treesit--install-language-grammar-1): Remove GRAMMAR-DIR.
This commit is contained in:
Yuan Fu 2022-12-31 14:27:51 -08:00
parent f9aef67c36
commit 0dc788aa01
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -2619,7 +2619,7 @@ window."
The value should be an alist where each element has the form The value should be an alist where each element has the form
(LANG . (URL SOURCE-DIR GRAMMAR-DIR CC C++)) (LANG . (URL SOURCE-DIR CC C++))
Only LANG and URL are mandatory. LANG is the language symbol. Only LANG and URL are mandatory. LANG is the language symbol.
URL is the Git repository URL for the grammar. URL is the Git repository URL for the grammar.
@ -2627,9 +2627,6 @@ URL is the Git repository URL for the grammar.
SOURCE-DIR is the relative subdirectory in the repository in which SOURCE-DIR is the relative subdirectory in the repository in which
the grammar's parser.c file resides, defaulting to \"src\". the grammar's parser.c file resides, defaulting to \"src\".
GRAMMAR-DIR is the relative subdirectory in the repository
in which the grammar.js file resides, defaulting to \".\".
CC and C++ are C and C++ compilers, defaulting to \"cc\" and CC and C++ are C and C++ compilers, defaulting to \"cc\" and
\"c++\", respectively.") \"c++\", respectively.")
@ -2683,7 +2680,7 @@ content as signal data, and erase buffer afterwards."
(erase-buffer))) (erase-buffer)))
(defun treesit--install-language-grammar-1 (defun treesit--install-language-grammar-1
(out-dir lang url &optional source-dir grammar-dir cc c++) (out-dir lang url &optional source-dir cc c++)
"Install and compile a tree-sitter language grammar library. "Install and compile a tree-sitter language grammar library.
OUT-DIR is the directory to put the compiled library file. If it OUT-DIR is the directory to put the compiled library file. If it
@ -2698,7 +2695,6 @@ function signals an error."
(default-directory (make-temp-file "treesit-workdir" t)) (default-directory (make-temp-file "treesit-workdir" t))
(workdir (expand-file-name "repo")) (workdir (expand-file-name "repo"))
(source-dir (expand-file-name (or source-dir "src") workdir)) (source-dir (expand-file-name (or source-dir "src") workdir))
(grammar-dir (expand-file-name (or grammar-dir "") workdir))
(cc (or cc (seq-find #'executable-find '("cc" "gcc" "c99")) (cc (or cc (seq-find #'executable-find '("cc" "gcc" "c99"))
;; If no C compiler found, just use cc and let ;; If no C compiler found, just use cc and let
;; `call-process' signal the error. ;; `call-process' signal the error.
@ -2717,10 +2713,8 @@ function signals an error."
(treesit--call-process-signal (treesit--call-process-signal
"git" nil t nil "clone" url "--depth" "1" "--quiet" "git" nil t nil "clone" url "--depth" "1" "--quiet"
workdir) workdir)
;; cp "${grammardir}"/grammar.js "${sourcedir}" ;; We need to go into the source directory because some
(copy-file (expand-file-name "grammar.js" grammar-dir) ;; header files use relative path (#include "../xxx").
(expand-file-name "grammar.js" source-dir)
t t)
;; cd "${sourcedir}" ;; cd "${sourcedir}"
(setq default-directory source-dir) (setq default-directory source-dir)
(message "Compiling library") (message "Compiling library")