; Fix recent treesit-related changes

* lisp/treesit.el (treesit-language-source-alist)
(treesit--install-language-grammar-1): Doc fixes.

* src/treesit.c (Ftreesit_language_abi_version): Fix a typo in
function's Lisp name.  Doc fix.
(Ftreesit_language_available_p): Fix a typo in the function's C
name.

* doc/lispref/parsing.texi (Language Grammar): Fix wording.
This commit is contained in:
Eli Zaretskii 2022-12-31 10:13:15 +02:00
parent ab1f245f1a
commit bfdad6c4e5
3 changed files with 19 additions and 18 deletions

View file

@ -154,9 +154,9 @@ them.
@end defun @end defun
@defun treesit-language-abi-version language @defun treesit-language-abi-version language
This function returns the language grammar @acronym{ABI} version of This function returns the @acronym{ABI} version of the language
language grammar for @var{language} loaded by Emacs. If grammar library loaded by Emacs for @var{language}. If @var{language}
@var{language} is unavailable, this function returns @code{nil}. is unavailable, this function returns @code{nil}.
@end defun @end defun
@heading Concrete syntax tree @heading Concrete syntax tree

View file

@ -2615,21 +2615,22 @@ window."
;;; Install & build language grammar ;;; Install & build language grammar
(defvar treesit-language-source-alist nil (defvar treesit-language-source-alist nil
"Configures how to download tree-sitter language grammars. "Configuration for downloading and installing tree-sitter language grammars.
This should be an alist of
The value should be an alist where each elemnt has the form
(LANG . (URL SOURCE-DIR GRAMMAR-DIR CC C++)) (LANG . (URL SOURCE-DIR GRAMMAR-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 repository's url. URL is the Git repository URL for the grammar.
SOURCE-DIR is the relative directory in the repository in which SOURCE-DIR is the relative subdirectory in the repository in which
the grammar.c file resides, default to \"src\". the grammar's parser.c file resides, defaulting to \"src\".
GRAMMAR-DIR is the relative grammar directory in the repository GRAMMAR-DIR is the relative subdirectory in the repository
in which the grammar.js file resides, default to \"\". in which the grammar.js file resides, defaulting to \".\".
CC and C++ are C and C++ compilers, default to \"cc\" and CC and C++ are C and C++ compilers, defaulting to \"cc\" and
\"c++\", respectively.") \"c++\", respectively.")
(defun treesit-install-language-grammar (lang) (defun treesit-install-language-grammar (lang)
@ -2687,8 +2688,8 @@ content as signal data, and erase buffer afterwards."
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
is nil, the \"tree-sitter\" directory under user's Emacs is nil, the \"tree-sitter\" directory under user's Emacs
configuration directory is used (and automatically created if not configuration directory is used (and automatically created if it
exist). does not exist).
For LANG, URL, SOURCE-DIR, GRAMMAR-DIR, CC, C++, see For LANG, URL, SOURCE-DIR, GRAMMAR-DIR, CC, C++, see
`treesit-language-source-alist'. If anything goes wrong, this `treesit-language-source-alist'. If anything goes wrong, this

View file

@ -632,7 +632,7 @@ treesit_load_language (Lisp_Object language_symbol,
return lang; return lang;
} }
DEFUN ("treesit-language-available-p", Ftreesit_langauge_available_p, DEFUN ("treesit-language-available-p", Ftreesit_language_available_p,
Streesit_language_available_p, Streesit_language_available_p,
1, 2, 0, 1, 2, 0,
doc: /* Return non-nil if LANGUAGE exists and is loadable. doc: /* Return non-nil if LANGUAGE exists and is loadable.
@ -679,14 +679,14 @@ is non-nil, return the oldest compatible ABI version. */)
return make_fixnum (TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION); return make_fixnum (TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION);
} }
DEFUN ("treesit-language-version", Ftreesit_language_abi_version, DEFUN ("treesit-language-abi-version", Ftreesit_language_abi_version,
Streesit_language_abi_version, Streesit_language_abi_version,
0, 1, 0, 0, 1, 0,
doc: /* Return the language ABI version of the tree-sitter LANGUAGE. doc: /* Return the ABI version of the tree-sitter grammar for LANGUAGE.
Return nil if LANGUAGE is not available. */) Return nil if a grammar library for LANGUAGE is not available. */)
(Lisp_Object language) (Lisp_Object language)
{ {
if (NILP (Ftreesit_langauge_available_p (language, Qnil))) if (NILP (Ftreesit_language_available_p (language, Qnil)))
return Qnil; return Qnil;
else else
{ {