Skip to content

Commit 86b3f95

Browse files
authored
Expand cider-font-lock-dynamically documentation (#3556)
1 parent 6baa3c3 commit 86b3f95

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

cider-mode.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,9 @@ that should be font-locked:
621621
`var': Any non-local var gets the `font-lock-variable-name-face'.
622622
`deprecated' (default): Any deprecated var gets the `cider-deprecated-face'
623623
face.
624-
`core' (default): Any symbol from clojure.core (face depends on type).
624+
`core' (default): Any symbol from clojure.core/cljs.core. The selected face will depend on type.
625+
Note that while rendering `core', all types of vars (`macro', `function', `var', `deprecated')
626+
will be honored, regardless of the user's customization value.
625627
626628
The value can also be t, which means to font-lock as much as possible."
627629
:type '(choice (set :tag "Fine-tune font-locking"
@@ -775,6 +777,8 @@ with the given LIMIT."
775777
macros functions vars instrumented traced)
776778
(cl-labels ((handle-plist
777779
(plist)
780+
;; Note that (memq 'function cider-font-lock-dynamically) and similar statements are evaluated differently
781+
;; for `core' - they're always truthy for `core' (see related core-handling code some lines below):
778782
(let ((do-function (memq 'function cider-font-lock-dynamically))
779783
(do-var (memq 'var cider-font-lock-dynamically))
780784
(do-macro (memq 'macro cider-font-lock-dynamically))
@@ -806,6 +810,7 @@ with the given LIMIT."
806810
(push sym functions))
807811
((and do-var (not is-function) (not is-macro))
808812
(push sym vars)))))))))
813+
;; For core members, we override `cider-font-lock-dynamically', since all core members should get the same treatment:
809814
(when (memq 'core cider-font-lock-dynamically)
810815
(let ((cider-font-lock-dynamically '(function var macro core deprecated)))
811816
(handle-plist core-plist)))

doc/modules/ROOT/pages/config/syntax_highlighting.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
== Dynamic syntax highlighting
44

55
CIDER can syntax highlight symbols that are known to be defined. By default,
6-
this is done on symbols from the `clojure.core` namespace, as well as macros
6+
this is done on symbols from the `clojure.core`/`cljs.core` namespaces, as well as macros
77
from any namespace. If you'd like CIDER to also colorize usages of functions
88
and variables from any namespace, do:
99

@@ -20,6 +20,8 @@ And here's how the code looks when it's turned on.
2020

2121
image::dynamic_font_lock_on.png[Dynamic Font-lock On]
2222

23+
You can refer to the `cider-font-lock-dynamically` Elisp documentation for further details.
24+
2325
== Syntax highlighting for reader conditionals
2426

2527
By default CIDER will apply font-locking to unused reader conditional

0 commit comments

Comments
 (0)