From: Eli Zaretskii Date: Sat, 31 Dec 2022 08:13:15 +0000 (+0200) Subject: ; Fix recent treesit-related changes X-Git-Tag: emacs-29.0.90~900 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bfdad6c4e5ce95025f1761a404b762589d126505;p=emacs.git ; 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. --- diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 8803991b725..aaf9d7060aa 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -154,9 +154,9 @@ them. @end defun @defun treesit-language-abi-version language -This function returns the language grammar @acronym{ABI} version of -language grammar for @var{language} loaded by Emacs. If -@var{language} is unavailable, this function returns @code{nil}. +This function returns the @acronym{ABI} version of the language +grammar library loaded by Emacs for @var{language}. If @var{language} +is unavailable, this function returns @code{nil}. @end defun @heading Concrete syntax tree diff --git a/lisp/treesit.el b/lisp/treesit.el index 56f9b681e80..5c3b68ea873 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2615,21 +2615,22 @@ window." ;;; Install & build language grammar (defvar treesit-language-source-alist nil - "Configures how to download tree-sitter language grammars. -This should be an alist of + "Configuration for downloading and installing tree-sitter language grammars. + +The value should be an alist where each elemnt has the form (LANG . (URL SOURCE-DIR GRAMMAR-DIR CC C++)) 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 -the grammar.c file resides, default to \"src\". +SOURCE-DIR is the relative subdirectory in the repository in which +the grammar's parser.c file resides, defaulting to \"src\". -GRAMMAR-DIR is the relative grammar directory in the repository -in which the grammar.js file resides, default to \"\". +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, default to \"cc\" and +CC and C++ are C and C++ compilers, defaulting to \"cc\" and \"c++\", respectively.") (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 is nil, the \"tree-sitter\" directory under user's Emacs -configuration directory is used (and automatically created if not -exist). +configuration directory is used (and automatically created if it +does not exist). For LANG, URL, SOURCE-DIR, GRAMMAR-DIR, CC, C++, see `treesit-language-source-alist'. If anything goes wrong, this diff --git a/src/treesit.c b/src/treesit.c index 974d2fc4517..e87bfc3429c 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -632,7 +632,7 @@ treesit_load_language (Lisp_Object language_symbol, return lang; } -DEFUN ("treesit-language-available-p", Ftreesit_langauge_available_p, +DEFUN ("treesit-language-available-p", Ftreesit_language_available_p, Streesit_language_available_p, 1, 2, 0, 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); } -DEFUN ("treesit-language-version", Ftreesit_language_abi_version, +DEFUN ("treesit-language-abi-version", Ftreesit_language_abi_version, Streesit_language_abi_version, 0, 1, 0, - doc: /* Return the language ABI version of the tree-sitter LANGUAGE. -Return nil if LANGUAGE is not available. */) + doc: /* Return the ABI version of the tree-sitter grammar for LANGUAGE. +Return nil if a grammar library for LANGUAGE is not available. */) (Lisp_Object language) { - if (NILP (Ftreesit_langauge_available_p (language, Qnil))) + if (NILP (Ftreesit_language_available_p (language, Qnil))) return Qnil; else {