You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This documentation tracks the `master` branch of `clojure-mode`. Some of
17
-
the features and settings discussed here might not be available in
18
-
older releases (including the current stable release). Please, consult
19
-
the relevant git tag (e.g. [5.19.0](https://github.com/clojure-emacs/clojure-mode/tree/v5.19.0)) if you need documentation for a
20
-
specific `clojure-mode` release.**
14
+
> [!IMPORTANT]
15
+
>
16
+
> This documentation tracks the `master` branch of `clojure-mode`. Some of the
17
+
>features and settings discussed here might not be available in older releases
18
+
> (including the current stable release). Please, consult the relevant git tag
19
+
> (e.g. [5.20.0](https://github.com/clojure-emacs/clojure-mode/tree/v5.20.0)) if
20
+
> you need documentation for a specific `clojure-mode` release.
21
21
22
22
## Installation
23
23
@@ -47,12 +47,12 @@ If the installation doesn't work try refreshing the package list:
47
47
48
48
The `clojure-mode` package actually bundles together several major modes:
49
49
50
-
*`clojure-mode` is a major mode for editing Clojure code
51
-
*`clojurescript-mode` is a major mode for editing ClojureScript code
52
-
*`clojurec-mode` is a major mode for editing `.cljc` source files
53
-
*`clojuredart-mode` is a major mode for editing ClojureDart `.cljd` source files
54
-
*`jank-mode` is a major mode for editing Jank `.jank` source files
55
-
*`joker-mode` is a major mode for editing Joker `.joke` source files
50
+
-`clojure-mode` is a major mode for editing Clojure code
51
+
-`clojurescript-mode` is a major mode for editing ClojureScript code
52
+
-`clojurec-mode` is a major mode for editing `.cljc` source files
53
+
-`clojuredart-mode` is a major mode for editing ClojureDart `.cljd` source files
54
+
-`jank-mode` is a major mode for editing Jank `.jank` source files
55
+
-`joker-mode` is a major mode for editing Joker `.joke` source files
56
56
57
57
All the major modes derive from `clojure-mode` and provide more or less the same
58
58
functionality. Differences can be found mostly in the font-locking -
@@ -140,14 +140,16 @@ The indentation of function forms is configured by the variable
140
140
2)
141
141
```
142
142
143
-
**Note:** Prior to clojure-mode 5.10, the configuration options for `clojure-indent-style` used to be
144
-
keywords, but now they are symbols. Keywords will still be supported at least until clojure-mode 6.
143
+
> [!NOTE]
144
+
>
145
+
> Prior to clojure-mode 5.10, the configuration options for `clojure-indent-style` used to be
146
+
> keywords, but now they are symbols. Keywords will still be supported at least until clojure-mode 6.
145
147
146
148
#### Indentation of keywords
147
149
148
150
Similarly we have the `clojure-indent-keyword-style`, which works in the following way:
149
151
150
-
*`always-align` (default) - All
152
+
-`always-align` (default) - All
151
153
args are vertically aligned with the first arg in case (A),
152
154
and vertically aligned with the function name in case (B).
153
155
@@ -159,7 +161,7 @@ Similarly we have the `clojure-indent-keyword-style`, which works in the followi
159
161
[bar.baz])
160
162
```
161
163
162
-
*`always-indent` - All args are indented like a macro body.
164
+
-`always-indent` - All args are indented like a macro body.
163
165
164
166
```clojure
165
167
(:require [foo.bar]
@@ -169,7 +171,7 @@ Similarly we have the `clojure-indent-keyword-style`, which works in the followi
169
171
0)
170
172
```
171
173
172
-
*`align-arguments` - Case (A) is indented like `always-align`, and
174
+
-`align-arguments` - Case (A) is indented like `always-align`, and
173
175
case (B) is indented like a macro body.
174
176
175
177
```clojure
@@ -288,7 +290,11 @@ You can change this behaviour like this:
288
290
You might also want to change `comment-add` to 0 in that way, so that Emacs comment
289
291
functions (e.g. `comment-region`) would use `;` by default instead of `;;`.
290
292
291
-
**Note:** Check out [this section](https://guide.clojure.style/#comments) of the Clojure style guide to understand better the semantics of the different comment levels and why `clojure-mode` treats them differently by default.
293
+
> [!TIP]
294
+
>
295
+
> Check out [this section](https://guide.clojure.style/#comments) of the Clojure
296
+
> style guide to understand better the semantics of the different comment levels
297
+
> and why `clojure-mode` treats them differently by default.
292
298
293
299
### Vertical alignment
294
300
@@ -315,9 +321,11 @@ happen whenever you select some code and hit `TAB`.
315
321
316
322
### Font-locking
317
323
318
-
`clojure-mode` features static font-locking (syntax highlighting) that you can extend yourself
319
-
if needed. As typical for Emacs, it's based on regular expressions. You can find
320
-
the default font-locking rules in `clojure-font-lock-keywords`. Here's how you can add font-locking for built-in Clojure functions and vars:
324
+
`clojure-mode` features static font-locking (syntax highlighting) that you can
325
+
extend yourself if needed. As typical for Emacs, it's based on regular
326
+
expressions. You can find the default font-locking rules in
327
+
`clojure-font-lock-keywords`. Here's how you can add font-locking for built-in
328
+
Clojure functions and vars:
321
329
322
330
```el
323
331
(defvar clojure-built-in-vars
@@ -360,9 +368,12 @@ var a symbol resolves to). That's why `clojure-mode`'s font-locking defaults are
360
368
conservative and minimalistic.
361
369
362
370
Precise font-locking requires additional data that can obtained from a running
363
-
REPL (that's how CIDER's [dynamic font-locking](https://docs.cider.mx/cider/config/syntax_highlighting.html) works) or from static code analysis.
When it comes to non built-in definitions, `clojure-mode` needs to be manually instructed how to handle the docstrings and highlighting. Here's an example:
375
+
When it comes to non built-in definitions, `clojure-mode` needs to be manually
376
+
instructed how to handle the docstrings and highlighting. Here's an example:
366
377
367
378
```emacs-lisp
368
379
(put '>defn 'clojure-doc-string-elt 2)
@@ -373,7 +384,9 @@ When it comes to non built-in definitions, `clojure-mode` needs to be manually i
373
384
1 font-lock-keyword-face)))
374
385
```
375
386
376
-
**Note:** The `clojure-doc-string-elt` attribute is processed by the function `clojure-font-lock-syntactic-face-function`.
387
+
> [!NOTE]
388
+
>
389
+
> The `clojure-doc-string-elt` attribute is processed by the function `clojure-font-lock-syntactic-face-function`.
377
390
378
391
## Refactoring support
379
392
@@ -481,7 +494,7 @@ without affecting the namespace declaration.
0 commit comments