Skip to content

Commit abec485

Browse files
author
Vadim Rodionov
committed
Describe in README how to add custom def forms
1 parent 3e1c4f6 commit abec485

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,15 @@ conservative and minimalistic.
305305
Precise font-locking requires additional data that can obtained from a running
306306
REPL (that's how CIDER's [dynamic font-locking](https://docs.cider.mx/cider/config/syntax_highlighting.html) works) or from static code analysis.
307307

308-
When it comes to definitions, `clojure-mode` employs a simple heuristic and will treat every symbol named `def`something as a built-in keyword. Still, you'll need to
309-
teach `clojure-mode` manually how to handle the docstrings of non built-in definition forms. Here's an example:
308+
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:
310309

311310
``` emacs-lisp
312311
(put '>defn 'clojure-doc-string-elt 2)
312+
313+
(font-lock-add-keywords 'clojure-mode
314+
`((,(concat "(\\(?:" clojure--sym-regexp "/\\)?"
315+
"\\(>defn\\)\\>")
316+
1 font-lock-keyword-face)))
313317
```
314318

315319
**Note:** The `clojure-doc-string-elt` attribute is processed by the function `clojure-font-lock-syntactic-face-function`.

0 commit comments

Comments
 (0)