Skip to content

Commit 211dc14

Browse files
committed
Update README docs to include new configuration options
and info about pre-packaged grammars offered by some linux distributions. Currently nixos offers these. I'm not sure about more traditional distros.
1 parent b6f6d37 commit 211dc14

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,33 @@ highlighting), indentation, and navigation support for the
1212
[tree-sitter-clojure](https://github.com/sogaiu/tree-sitter-clojure)
1313
[tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar.
1414

15+
## Configuration
16+
17+
To see a list of available configuration options do M-x customize-group RET clojure-ts.
18+
19+
Most configuration changes will require reverting any active clojure-ts-mode buffers.
20+
21+
### Indentation
22+
23+
clojure-ts-mode currently supports 2 different indentation strategies
24+
- `semantic`, the default, which tries to match the indentation of clojure-mode and cljfmt
25+
- `fixed`, [a simple indentation strategy outlined by Tonsky in a blog post](https://tonsky.me/blog/clojurefmt/)
26+
27+
Set the var `clojure-ts-indent-style` to change it.
28+
``` emacs-lisp
29+
(setq clojure-ts-indent-style 'fixed)
30+
```
31+
32+
### Font Locking
33+
34+
Too highlight entire rich `comment` expression with the comment font face, set
35+
``` emacs-lisp
36+
(setq clojure-ts-comment-macro-font-lock-body t)
37+
```
38+
39+
By default this is `nil`, so that anything within a `comment` expression is
40+
highlighted like regular clojure code.
41+
1542
## Rationale
1643

1744
[clojure-mode](https://github.com/clojure-emacs/clojure-mode) has served us well
@@ -35,8 +62,6 @@ You can read more about the vision for `clojure-ts-mode` [here](https://metaredu
3562

3663
**This library is still under development. Breaking changes should be expected.**
3764

38-
You can track the current progress towards an initial release [here](https://github.com/clojure-emacs/clojure-ts-mode/issues/1).
39-
4065
## Installation
4166

4267
### Emacs 29
@@ -83,11 +108,26 @@ Once installed, evaluate clojure-ts-mode.el and you should be ready to go.
83108

84109
### Install libtree-sitter-clojure shared library
85110

111+
#### From your OS
112+
113+
Some distributions may package the tree-sitter-clojure grammar in their package repositories.
114+
If yours does you may be able to install tree-sitter-clojure with your system package manager.
115+
116+
If the version packaged by your OS is out of date, you may see errors in the `*Messages*` buffer or your clojure buffers will not have any syntax highlighting.
117+
If this happens you should install the grammar manually with `M-x treesit-install-language-grammar <RET> clojure`.
118+
119+
#### Manually
120+
86121
The tree-sitter clojure shared library must be available to Emacs.
87-
If you have `git` and a C compiler (`cc`) available on your system's `PATH`, **then these steps are not necessary**.
122+
If you have `git` and a C compiler (`cc`) available on your system's `PATH`, **then these steps should not be necessary**.
88123
clojure-ts-mode will install the grammar when you first open a Clojure file.
89124

90125
If clojure-ts-mode fails to automatically install the grammar, you have the option to install it manually.
126+
127+
The first way is to run `M-x treesit-install-language-grammar <RET> clojure` in Emacs.
128+
This is what clojure-ts-mode attempts to do when a suitable grammar is not found.
129+
130+
If that fails, you can attempt to download and compile manually.
91131
All you need is `git` and a C compiler (GCC works well).
92132

93133
To start, clone [tree-sitter-clojure](https://github.com/sogaiu/tree-sitter-clojure).

0 commit comments

Comments
 (0)