Affected mode
clojure-mode
Expected behavior
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.
Steps to reproduce
Based on Datomic docs:
(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
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
Operating system
macOS Sequoia 15.8
Affected mode
clojure-mode
Expected behavior
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 bysyntax-ppssto comments/docstrings/strings. This causes false-positivehighlighting in live Datalog/Datomic code, where
[[var]]is legitimatebinding syntax (a relation binding, as opposed to
[var]for a tuple bindingor
[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 onlyfire inside strings/comments, matching their intended use for docstrings.
Steps to reproduce
Based on Datomic docs:
All five occurrences of
?durationare the same logic variable, but the oneinside
[[?duration]]getsfont-lock-constant-face(matched by thewikilink 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
emacs -Qclojure-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
Operating system
macOS Sequoia 15.8