https://github.com/wkirschbaum/elixir-ts-mode
Elixir mode using Treesitter for fontification, navigation and indentation
https://github.com/wkirschbaum/elixir-ts-mode
elixir emacs tree-sitter
Last synced: 7 days ago
JSON representation
Elixir mode using Treesitter for fontification, navigation and indentation
- Host: GitHub
- URL: https://github.com/wkirschbaum/elixir-ts-mode
- Owner: wkirschbaum
- License: gpl-3.0
- Created: 2022-10-11T21:08:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T06:45:44.000Z (9 months ago)
- Last Synced: 2025-04-22T07:47:42.714Z (9 months ago)
- Topics: elixir, emacs, tree-sitter
- Language: Emacs Lisp
- Homepage:
- Size: 528 KB
- Stars: 66
- Watchers: 4
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Elixir Major Mode using tree-sitter
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://melpa.org/#/elixir-ts-mode)

> [!NOTE]
> This package was a backport from Emacs 30.1 for the use with Emacs 29.1 and won't receive any additional updates.
For an implementation without tree-sitter support please have a
look at: https://github.com/elixir-editors/emacs-elixir
This package is compatible with and was tested against the tree-sitter grammar
for Elixir found at https://github.com/elixir-lang/tree-sitter-elixir.
## Installing
Emacs 29.1 or above with tree-sitter support is required.
Tree-sitter starter guide: https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=emacs-29
You can install the tree-sitter Elixir and HEEx grammars by running: `M-x elixir-ts-install-grammar`.
### Using MELPA and use-package
```elisp
(use-package elixir-ts-mode
:ensure t)
```
### From source
- Clone this repository
- Add the following to your emacs config
It is also necessary to clone
[heex-ts-mode](https://github.com/wkirschbaum/heex-ts-mode) and
load the heex-ts-mode.el file before loading elixir-ts-mode.el:
```elisp
(load "[cloned wkirschbaum/heex-ts-mode]/heex-ts-mode.el")
(load "[cloned wkirschbaum/elixir-ts-mode]/elixir-ts-mode.el")
```
### Installing emacs-29 on Mac OS or Linux via Homebrew
This uses [Emacs Plus](https://github.com/d12frosted/homebrew-emacs-plus). Note
that we grab its "tap" so Homebrew will know about its formula.
```bash
brew install tree-sitter
brew tap d12frosted/emacs-plus
brew install emacs-plus@29
```
### Troubleshooting
If you get the following warning:
```
⛔ Warning (treesit): Cannot activate tree-sitter, because tree-sitter
library is not compiled with Emacs [2 times]
```
Then you do not have tree-sitter support for your emacs installation.
If you get the following warnings:
```
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for heex is unavailable (not-found): (libtree-sitter-heex libtree-sitter-heex.so) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for elixir is unavailable (not-found): (libtree-sitter-elixir libtree-sitter-elixir.so) No such file or directory
```
then the grammar files are not properly installed on your system.
## Development
To test you can run `make test` which will download a batch script
from https://github.com/casouri/tree-sitter-module and compile
tree-sitter-elixir as well as tree-sitter-heex.
Requirements:
- tree-sitter
- make
- gcc
- git
- curl
Please make sure you run `M-x byte-compile-file` against the updated
file(s) with an emacs version --with-tree-sitter=no to ensure it still
works for non tree-sitter users.