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
{{ message }}
Repository navigation
[[var]] wikilink font-lock rule collides with Datalog/Datomic relation-binding syntax #707
Datalog vars in [[double square brackets]] get the same syntax highlighting as elsewhere.
Actual behavior
The [[var]] docstring-wikilink font-lock rule (added in #496) matches any [[symbol]]-shaped text regardless of syntactic context — it isn't gated by syntax-ppss to comments/docstrings/strings. This causes false-positive
highlighting in live Datalog/Datomic code, where [[var]] is legitimate
binding syntax (a relation binding, as opposed to [var] for a tuple binding
or [var ...] for a collection binding).
Version: clojure-mode 20250527.840 (current master exhibits the same
behavior as of 2026-09-23).
Suggested fix: gate the [[var]] (and backtick `code`) rules on (nth 3 (syntax-ppss (match-beginning 0))) or (nth 4 ...) so they only
fire inside strings/comments, matching their intended use for docstrings.
(d/q '[:find ?track ?name ?duration
:where
[(q '[:find (min ?duration)
:where [_ :track/duration ?duration]]
$) [[?duration]]] ; <--------------------- this guy ain't right
[?track :track/duration ?duration]
[?track :track/name ?name]]
db)
All five occurrences of ?duration are the same logic variable, but the one
inside [[?duration]] gets font-lock-constant-face (matched by the
wikilink rule at clojure-mode.el:1229-1232) while the other four get the
default face — inconsistent highlighting with no semantic basis.
Reproducible with emacs -Q
I've reproduced this with emacs -Q
clojure-mode version
20250527.840
Emacs version
GNU Emacs 30.2.50 (build 1, aarch64-apple-darwin24.6.0, Carbon Version 170 AppKit 2575.7) of 2026-03-09
Activity
[Fix clojure-emacs#707] Highlight [[var]] and `code` only in strings …