Last active
June 27, 2023 14:13
-
-
Save sogaiu/a13512e146e8f5c0e94d1804838558ee to your computer and use it in GitHub Desktop.
prepare emacs master / emacs-29 branch with tree-sitter on ubuntu for janet-ts-mode (2023-04-02)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from content at https://www.reddit.com/r/emacs/comments/z25iyx/treesitter_has_been_merged_into_master/ | |
# install tree-sitter | |
cd ~/src | |
git clone https://github.com/tree-sitter/tree-sitter.git | |
cd tree-sitter | |
# NOTE: update version in Makefile to 0.20.7 | |
sed -i 's/^VERSION := 0\.6\.3$/VERSION := 0.20.7/' Makefile | |
make | |
# NOTE: manually correct 'pkgname', 'pkgversion', and 'provides' | |
sudo checkinstall --pkgname tree-sitter --pkgversion 0.20.7 --provides tree-sitter --default | |
sudo dpkg -i tree-sitter_0.20.7-1_amd64.deb | |
# teach system about where to find tree-sitter library | |
sudo ldconfig | |
# emacs dependencies -- not sure how long this will remain valid | |
sudo apt build-dep emacs | |
# for native compilation option | |
sudo apt install libgccjit-11-dev | |
# clone emacs source | |
cd ~/src | |
git clone https://github.com/emacs-mirror/emacs/ | |
cd emacs | |
# optionally, use the emacs-29 branch instead of master | |
git checkout emacs-29 | |
# create configure script | |
bash autogen.sh | |
# change --prefix=... if necessary | |
./configure --with-native-compilation --with-json --with-cairo --with-tree-sitter --prefix=$HOME/.local | |
# build and install | |
make -j | |
make install | |
# prepare appropriate .so for janet tree-sitter grammar | |
cd ~/src | |
git clone https://github.com/casouri/tree-sitter-module | |
cd tree-sitter-module | |
# build .so | |
bash build.sh janet-simple | |
# optionally, make emacs aware of the .so file | |
ln -s ~/src/tree-sitter-mode/dist ~/.emacs.d/tree-sitter | |
# n.b. it doesn't have to be done via symlink as above. two other ways: | |
# | |
# 1) can also add something like: | |
# | |
# (setq treesit-extra-load-path '("~/src/tree-sitter-module/dist")) | |
# | |
# to one's .emacs-equivalent | |
# | |
# -OR- | |
# | |
# 2) put the .so file in a system location for .so files | |
# possibly useful links: | |
# https://blog.markhepburn.com/posts/experimenting-with-the-built-in-treesitter-support-in-emacs/ | |
# https://github.com/emacs-mirror/emacs/blob/master/admin/notes/tree-sitter/starter-guide#install-language-definitions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment