diff options
| author | Eli Zaretskii | 2022-12-18 12:08:22 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2022-12-18 12:08:22 +0200 |
| commit | 88e59b16cbe293f480e7d142dd3c8cb01e7ff225 (patch) | |
| tree | 1648597c685bfa1d409a68b657f5bb493caa865e | |
| parent | 897f33bf316dd95107377c7bc7a9162482abcc4c (diff) | |
| download | emacs-88e59b16cbe293f480e7d142dd3c8cb01e7ff225.tar.gz emacs-88e59b16cbe293f480e7d142dd3c8cb01e7ff225.zip | |
; Improve documentation of installing tree-sitter and grammars.
* etc/NEWS: Enhance tree-sitter sections wrt grammar libraries.
| -rw-r--r-- | etc/NEWS | 51 |
1 files changed, 51 insertions, 0 deletions
| @@ -40,6 +40,34 @@ modes, described elsewhere in this file, that are based on the | |||
| 40 | installed, the configure script will automatically include it in the | 40 | installed, the configure script will automatically include it in the |
| 41 | build; use '--without-tree-sitter' at configure time to disable that. | 41 | build; use '--without-tree-sitter' at configure time to disable that. |
| 42 | 42 | ||
| 43 | Emacs modes based on the tree-sitter library require an additional | ||
| 44 | grammar library for each mode. These grammar libraries provide the | ||
| 45 | tree-sitter library with language-specific lexical analysis and | ||
| 46 | parsing capabilities, and are developed separately from the | ||
| 47 | tree-sitter library itself. If you don't have a grammar library | ||
| 48 | required by some Emacs major mode, and your distro doesn't provide it | ||
| 49 | as an installable package, you can compile and install such a library | ||
| 50 | yourself. Many libraries can be downloaded from the tree-sitter site: | ||
| 51 | |||
| 52 | https://github.com/tree-sitter | ||
| 53 | |||
| 54 | To compile such a library, compile the files scanner.c and parser.c | ||
| 55 | (sometimes named scanner.cc and parser.cc) in the 'src' subdirectory | ||
| 56 | of the library's source tree using the C or C++ compiler, then link | ||
| 57 | these two files into a shared library named 'libtree-sitter-LANG.so', | ||
| 58 | where LANG is the name of the language supported by the grammar as it | ||
| 59 | is expected by the Emacs major mode (for example, "c" for c-ts-mode, | ||
| 60 | "cpp" for c++-ts-mode, "python" for python-ts-mode, etc.). Then place | ||
| 61 | the shared library you've built in the same directory where you keep | ||
| 62 | the other shared libraries used by Emacs, or in the 'tree-sitter' | ||
| 63 | subdirectory of your 'user-emacs-directory', or in a directory | ||
| 64 | mentioned in the variable 'treesit-extra-load-path'. | ||
| 65 | |||
| 66 | You only need to install language grammar libraries required by the | ||
| 67 | Emacs modes you will use, as Emacs loads these libraries only when the | ||
| 68 | corresponding mode is turned on in some buffer for the first time in | ||
| 69 | an Emacs session. | ||
| 70 | |||
| 43 | +++ | 71 | +++ |
| 44 | ** Emacs can be built with built-in support for accessing SQLite databases. | 72 | ** Emacs can be built with built-in support for accessing SQLite databases. |
| 45 | This uses the popular sqlite3 library, and can be disabled by using | 73 | This uses the popular sqlite3 library, and can be disabled by using |
| @@ -3028,6 +3056,29 @@ indentation, and navigation by defuns based on parsing the buffer text | |||
| 3028 | by a tree-sitter parser. Some major modes also offer support for | 3056 | by a tree-sitter parser. Some major modes also offer support for |
| 3029 | Imenu and 'which-func'. | 3057 | Imenu and 'which-func'. |
| 3030 | 3058 | ||
| 3059 | Where major modes already exist in Emacs for editing certain kinds of | ||
| 3060 | files, the new modes based on tree-sitter are for now entirely | ||
| 3061 | optional, and you must turn them on manually, or customize | ||
| 3062 | 'auto-mode-alist' to turn them on automatically. | ||
| 3063 | |||
| 3064 | Each major mode based on tree-sitter needs a language grammar library, | ||
| 3065 | usually named 'libtree-sitter-LANG.so' ('libtree-sitter-LANG.dll' on | ||
| 3066 | MS-Windows), where LANG is the corresponding language name. Emacs | ||
| 3067 | looks for these libraries in the following places: | ||
| 3068 | |||
| 3069 | . in the directories mentioned in the list 'treesit-extra-load-path' | ||
| 3070 | . in the 'tree-sitter' subdirectory of your 'user-emacs-directory' | ||
| 3071 | (by default, '~/.emacs.d/tree-sitter') | ||
| 3072 | . in the standard system directories where other shared libraries are | ||
| 3073 | usually installed | ||
| 3074 | |||
| 3075 | We recommend to install these libraries in one of the standard system | ||
| 3076 | locations (the last place in the above list). | ||
| 3077 | |||
| 3078 | If a language grammar library required by a mode is not found in any | ||
| 3079 | of the above places, the mode will signal an error when you try to | ||
| 3080 | turn it on. | ||
| 3081 | |||
| 3031 | *** New major mode 'typescript-ts-mode'. | 3082 | *** New major mode 'typescript-ts-mode'. |
| 3032 | A major mode based on the tree-sitter library for editing programs | 3083 | A major mode based on the tree-sitter library for editing programs |
| 3033 | in the TypeScript language. This mode is auto-enabled for files with | 3084 | in the TypeScript language. This mode is auto-enabled for files with |