Skip to content

clojure-emacs/clojure-ts-mode

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

License GPL 3

Clojure Tree-Sitter Mode

clojure-ts-mode is an Emacs major mode that provides font-lock (syntax highlighting), indentation, and navigation support for the Clojure(Script) programming language, powered by the tree-sitter-clojure tree-sitter grammar.

Installation

Emacs 29

This package requires Emacs 29 built with tree-sitter support from the emacs-29 branch. As of right now, users must install Emacs from source with tree-sitter installed on their system. More information on this can be found in the Emacs repository:

Install libtree-sitter-clojure shared library

The tree-sitter clojure shared library must be available to Emacs. clojure-ts-mode will not automatically install this (yet). For now, users must do it themselves manually, which requires that a c compiler be installed.

To start, clone tree-sitter-clojure.

Then run the following code (depending on your OS) from the tree-sitter-clojure repository on your machine. (A C compiler like GCC is required)

Linux

mkdir -p dist
cc -c -I./src src/parser.c -o "parser.o"
cc -fPIC -shared src/parser.o -o "dist/libtree-sitter-clojure.so"

macOS

mkdir -p dist
cc -c -I./src src/parser.c -o "parser.o"
cc -fPIC -shared src/parser.o -o "dist/libtree-sitter-clojure.dylib"

Windows

I don't know how to do this on Windows. Patches welcome!

Finally, in emacs

Then tell Emacs where to find the shared library by adding something like this to your init file

(setq treesit-extra-load-path '( "~/path/to/tree-sitter-clojure/dist"))

OR you can move the libtree-sitter-clojure.so/libtree-sitter-clojure.dylib to a directory named tree-sitter under your user-emacs-directory.

Install clojure-ts-mode

This package is not yet avaialble through package.el. You can install it by cloning the repository and adding it to your load path.

git clone https://github.com/clojure-emacs/clojure-ts-mode.git
(add-to-list 'load-path "~/path/to/clojure-ts-mode/")

License

Copyright © 2022 Danny Freeman and contributors.

Distributed under the GNU General Public License; type C-h C-c to view it.

About

The next generation Clojure major mode for Emacs, powered by TreeSitter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published