mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-16 02:50:26 -08:00
; Improve documentation of 'treesit-language-source-alist'
* lisp/treesit.el (treesit--install-language-grammar-build-recipe) (treesit-install-language-grammar): Doc fixes. (treesit-install-language-grammar): Autoload it. * etc/NEWS: Improve wording of the 'treesit-install-language-grammar' documentation.
This commit is contained in:
parent
ae0d218d0b
commit
0b0eae0bf7
2 changed files with 12 additions and 8 deletions
13
etc/NEWS
13
etc/NEWS
|
|
@ -63,18 +63,17 @@ the other shared libraries used by Emacs, or in the "tree-sitter"
|
||||||
subdirectory of your 'user-emacs-directory', or in a directory
|
subdirectory of your 'user-emacs-directory', or in a directory
|
||||||
mentioned in the variable 'treesit-extra-load-path'.
|
mentioned in the variable 'treesit-extra-load-path'.
|
||||||
|
|
||||||
Emacs provides a user command, 'treesit-install-language-grammar',
|
|
||||||
that automates the building process. A third-party major mode package
|
|
||||||
could instruct its users to set 'treesit-language-source-alist'
|
|
||||||
accordingly and use that command to download and compile the language
|
|
||||||
grammar. A user could also use that command directly and manually
|
|
||||||
guide it through the process.
|
|
||||||
|
|
||||||
You only need to install language grammar libraries required by the
|
You only need to install language grammar libraries required by the
|
||||||
Emacs modes you will use, as Emacs loads these libraries only when the
|
Emacs modes you will use, as Emacs loads these libraries only when the
|
||||||
corresponding mode is turned on in some buffer for the first time in
|
corresponding mode is turned on in some buffer for the first time in
|
||||||
an Emacs session.
|
an Emacs session.
|
||||||
|
|
||||||
|
Emacs provides a user command, 'treesit-install-language-grammar',
|
||||||
|
that automates the download and build process of a grammar library.
|
||||||
|
It prompts for the language, the URL of the language grammar's VCS
|
||||||
|
repository, and then uses the installed C/C++ compiler to build the
|
||||||
|
library and install it.
|
||||||
|
|
||||||
+++
|
+++
|
||||||
** Emacs can be built with built-in support for accessing SQLite databases.
|
** Emacs can be built with built-in support for accessing SQLite databases.
|
||||||
This uses the popular sqlite3 library, and can be disabled by using
|
This uses the popular sqlite3 library, and can be disabled by using
|
||||||
|
|
|
||||||
|
|
@ -2633,7 +2633,7 @@ CC and C++ are C and C++ compilers, defaulting to \"cc\" and
|
||||||
\"c++\", respectively.")
|
\"c++\", respectively.")
|
||||||
|
|
||||||
(defun treesit--install-language-grammar-build-recipe (lang)
|
(defun treesit--install-language-grammar-build-recipe (lang)
|
||||||
"Interactively build a recipe for LANG and return it.
|
"Interactively produce a download/build recipe for LANG and return it.
|
||||||
See `treesit-language-source-alist' for details."
|
See `treesit-language-source-alist' for details."
|
||||||
(when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang))
|
(when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang))
|
||||||
(cl-labels ((empty-string-to-nil (string)
|
(cl-labels ((empty-string-to-nil (string)
|
||||||
|
|
@ -2655,9 +2655,14 @@ See `treesit-language-source-alist' for details."
|
||||||
(read-string
|
(read-string
|
||||||
"Enter the C++ compiler to use (default: auto-detect): "))))))
|
"Enter the C++ compiler to use (default: auto-detect): "))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun treesit-install-language-grammar (lang)
|
(defun treesit-install-language-grammar (lang)
|
||||||
"Build and install the tree-sitter language grammar library for LANG.
|
"Build and install the tree-sitter language grammar library for LANG.
|
||||||
|
|
||||||
|
Interactively, if `treesit-language-source-alist' doesn't already
|
||||||
|
have data for building the grammar for LANG, prompt for its
|
||||||
|
repository URL and the C/C++ compiler to use.
|
||||||
|
|
||||||
This command requires Git, a C compiler and (sometimes) a C++ compiler,
|
This command requires Git, a C compiler and (sometimes) a C++ compiler,
|
||||||
and the linker to be installed and on PATH. It also requires that the
|
and the linker to be installed and on PATH. It also requires that the
|
||||||
recipe for LANG exists in `treesit-language-source-alist'.
|
recipe for LANG exists in `treesit-language-source-alist'.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue