Variable: clojure-font-lock-keywords
clojure-font-lock-keywords is a variable defined in clojure-mode.el.
Value
Large value
(("(\\(?:[^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*/\\)?\\(\\(?:def\\(?:in\\(?:\\(?:lin\\|terfac\\)e\\)\\|m\\(?:acro\\|ethod\\|ulti\\)\\|n[acemu-]?\\|once\\|pro\\(?:ject\\|tocol\\)\\|record\\|st\\(?:ate\\|ruct\\)\\|t\\(?:ask\\|est-?\\|ype\\)\\)?\\)\\)\\>"
(1 font-lock-keyword-face))
("(\\(?:clojure.core/\\)?\\(\\(?:def\\(?:once\\)?\\)\\)\\>[
\n ]*\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[
\n ]*\\)*\\(\\sw+\\)?"
(2 font-lock-variable-name-face nil t))
("(\\(?:clojure.core/\\)?\\(\\(?:def\\(?:protocol\\|record\\|struct\\|type\\)\\)\\)\\>[
\n ]*\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[
\n ]*\\)*\\(\\sw+\\)?"
(2 font-lock-type-face nil t))
("(\\(?:clojure.core/\\)?\\(\\(?:def\\(?:inline\\|m\\(?:acro\\|ethod\\|ulti\\)\\|n-?\\|test-?\\)\\)\\)\\>[
\n ]*\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[
\n ]*\\)*\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\)?"
(2 font-lock-function-name-face nil t))
("(\\(?:clojure.core/\\)?\\(fn\\)[ ]+\\(?:#?^\\sw+[ ]*\\)?\\(\\sw+\\)?"
(2 font-lock-function-name-face nil t))
(clojure--search-letfn-name
(1 font-lock-function-name-face))
("(\\(\\.\\|catch\\|do\\|f\\(?:inally\\|n\\*?\\)\\|if\\|l\\(?:\\(?:et\\|oop\\)\\*\\)\\|monitor-e\\(?:nter\\|xit\\)\\|new\\|quote\\|recur\\|set!\\|t\\(?:hrow\\|ry\\)\\|var\\)\\>" 1 font-lock-keyword-face)
("(\\(?:clojure.core/\\)?\\(->>?\\|\\.\\.\\|a\\(?:map\\|nd\\|reduce\\|s\\(?:->\\|sert\\)\\)\\|b\\(?:inding\\|ound-fn\\)\\|c\\(?:ase\\|o\\(?:mment\\|nd\\(?:->>?\\|p\\)?\\)\\)\\|d\\(?:e\\(?:clare\\|lay\\)\\|o\\(?:all\\|run\\|s\\(?:eq\\|ync\\)\\|t\\(?:imes\\|o\\)\\)\\)\\|extend-\\(?:protocol\\|type\\)\\|f\\(?:or\\|uture\\)\\|gen-\\(?:class\\|interface\\)\\|i\\(?:f-\\(?:let\\|not\\|some\\)\\|mport\\|n-ns\\|o!\\)\\|l\\(?:azy-\\(?:cat\\|seq\\)\\|et\\(?:fn\\)?\\|o\\(?:cking\\|op\\)\\)\\|memfn\\|ns\\|or\\|p\\(?:roxy\\(?:-super\\)?\\|values\\)\\|re\\(?:fer-clojure\\|ify\\)\\|s\\(?:ome->>?\\|ync\\)\\|time\\|vswap!\\|w\\(?:h\\(?:en\\(?:-\\(?:first\\|let\\|not\\|some\\)\\)?\\|ile\\)\\|ith-\\(?:bindings\\|in-str\\|lo\\(?:ading-context\\|cal-vars\\)\\|o\\(?:pen\\|ut-str\\)\\|precision\\|redefs\\(?:-fn\\)?\\)\\)\\)\\>" 1 font-lock-keyword-face)
("\\_<\\(?:let\\|wh\\(?:en\\|ile\\)\\)-\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-keyword-face)
("\\<\\(\\*\\(?:\\(?:a\\(?:gent\\|llow-unresolved-vars\\|ssert\\)\\|c\\(?:lojure-version\\|om\\(?:mand-line-args\\|pile\\(?:-\\(?:files\\|path\\)\\|r-options\\)\\)\\)\\|d\\(?:ata-readers\\|efault-data-reader-fn\\)\\|err\\|f\\(?:ile\\|lush-on-newline\\|n-loader\\)\\|in\\|math-context\\|ns\\|out\\|print-\\(?:dup\\|le\\(?:ngth\\|vel\\)\\|meta\\|namespace-maps\\|readably\\)\\|re\\(?:ad\\(?:-eval\\|er-resolver\\)\\|pl\\)\\|source-path\\|u\\(?:nchecked-math\\|se-context-classloader\\)\\|warn-on-reflection\\)\\*\\|[123e]\\)\\)\\>" 0 font-lock-builtin-face)
("\\(?:\\<\\|/\\)@?\\(\\*[^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\*\\)\\>" 1 font-lock-variable-name-face)
("\\<\\(false\\|nil\\|true\\)\\>" 0 font-lock-constant-face)
("\\(\\\\\\(?:.\\|newline\\|space\\|tab\\|formfeed\\|backspace\\|return\\|u[0-9A-Fa-f]\\{4\\}\\|o[0-7]\\{1,3\\}\\)\\)\\(?:[^[:word:]]\\|\\b\\)" 1 'clojure-character-face)
("\\<%[&1-9]*"
(0 font-lock-variable-name-face))
("(\\<ns\\>[
\n ]*\\(?:\\^?\\(?:{[^}]+}\\|:[^
\n ]+[
\n ]\\)[
\n ]*\\)*\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 font-lock-type-face))
("\\(:\\{1,2\\}\\)\\([^][\";@\\^`~(){}\\, \n
:'][^][\";@\\^`~(){}\\, \n
]*?\\)\\(/\\)\\([^][\";@\\^`~(){}\\, \n
:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 'clojure-keyword-face)
(2 font-lock-type-face)
(3 'default)
(4 'clojure-keyword-face))
("\\<\\(:\\{1,2\\}\\)\\([^][\";@\\^`~(){}\\, \n
:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 'clojure-keyword-face)
(2 'clojure-keyword-face))
("\\(#?\\^\\)\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*?\\)\\(/\\)\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 'default)
(2 font-lock-type-face)
(3 'default)
(4 'default))
("\\(#?\\^\\)\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 'default)
(2 font-lock-type-face))
("\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*?\\)\\(/\\)\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 font-lock-type-face)
(2 nil)
(3 nil))
("\\([^][\";@\\^`~(){}\\, \n
0-9:'][^][\";@\\^`~(){}\\, \n
]*\\)"
(1 nil))
(clojure--search-comment-macro 1
(if
(eq
(char-after
(match-beginning 0))
35)
'clojure-discard-face font-lock-comment-face)
t)
("`\\(?1:\\(?:#'\\)?\\(?:\\s_\\|\\sw\\)+\\)`"
(1 'font-lock-constant-face prepend))
("\\[\\[\\(?1:\\(?:#'\\)?\\(?:\\s_\\|\\sw\\)+\\)]]"
(1 'font-lock-constant-face prepend))
(clojure-font-lock-escaped-chars 0 'bold prepend)
(clojure-font-lock-regexp-groups
(1 'font-lock-regexp-grouping-construct prepend)))
Documentation
Default expressions to highlight in Clojure mode.
Source Code
;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defconst clojure-font-lock-keywords
(eval-when-compile
`(;; Any def form
(,(concat "(\\(?:" clojure--sym-regexp "/\\)?"
"\\("
(regexp-opt '("def"
"defonce"
"defn"
"defn-"
"defmacro"
"definline"
"defmulti"
"defmethod"
"defprotocol"
"definterface"
"defrecord"
"deftype"
"defstruct"
;; clojure.test
"deftest"
"deftest-"
;; clojure.logic
"defne"
"defnm"
"defnu"
"defnc"
"defna"
;; Third party
"deftask"
"defstate"
"defproject"))
"\\)\\>")
(1 font-lock-keyword-face))
;; Top-level variable definition
(,(concat "(\\(?:clojure.core/\\)?\\("
(regexp-opt '("def" "defonce"))
;; variable declarations
"\\)\\>"
;; Any whitespace
"[ \r\n\t]*"
;; Possibly type or metadata
"\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*"
"\\(\\sw+\\)?")
(2 font-lock-variable-name-face nil t))
;; Type definition
(,(concat "(\\(?:clojure.core/\\)?\\("
(regexp-opt '("defstruct" "deftype" "defprotocol"
"defrecord"))
;; type declarations
"\\)\\>"
;; Any whitespace
"[ \r\n\t]*"
;; Possibly type or metadata
"\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*"
"\\(\\sw+\\)?")
(2 font-lock-type-face nil t))
;; Function definition
(,(concat "(\\(?:clojure.core/\\)?\\("
(regexp-opt '("defn"
"defn-"
"defmulti"
"defmethod"
"deftest"
"deftest-"
"defmacro"
"definline"))
"\\)"
;; Function declarations
"\\>"
;; Any whitespace
"[ \r\n\t]*"
;; Possibly type or metadata
"\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*"
(concat "\\(" clojure--sym-regexp "\\)?"))
(2 font-lock-function-name-face nil t))
;; (fn name? args ...)
(,(concat "(\\(?:clojure.core/\\)?\\(fn\\)[ \t]+"
;; Possibly type
"\\(?:#?^\\sw+[ \t]*\\)?"
;; Possibly name
"\\(\\sw+\\)?" )
(2 font-lock-function-name-face nil t))
;; Function names in letfn bindings
(clojure--search-letfn-name
(1 font-lock-function-name-face))
;; Special forms
(,(concat
"("
(regexp-opt
'("do" "if" "let*" "var" "fn" "fn*" "loop*"
"recur" "throw" "try" "catch" "finally"
"set!" "new" "."
"monitor-enter" "monitor-exit" "quote") t)
"\\>")
1 font-lock-keyword-face)
;; Built-in binding and flow of control forms
(,(concat
"(\\(?:clojure.core/\\)?"
(regexp-opt
'(
"->"
"->>"
".."
"amap"
"and"
"areduce"
"as->"
"assert"
"binding"
"bound-fn"
"case"
"comment"
"cond"
"cond->"
"cond->>"
"condp"
"declare"
"delay"
"doall"
"dorun"
"doseq"
"dosync"
"dotimes"
"doto"
"extend-protocol"
"extend-type"
"for"
"future"
"gen-class"
"gen-interface"
"if-let"
"if-not"
"if-some"
"import"
"in-ns"
"io!"
"lazy-cat"
"lazy-seq"
"let"
"letfn"
"locking"
"loop"
"memfn"
"ns"
"or"
"proxy"
"proxy-super"
"pvalues"
"refer-clojure"
"reify"
"some->"
"some->>"
"sync"
"time"
"vswap!"
"when"
"when-first"
"when-let"
"when-not"
"when-some"
"while"
"with-bindings"
"with-in-str"
"with-loading-context"
"with-local-vars"
"with-open"
"with-out-str"
"with-precision"
"with-redefs"
"with-redefs-fn"
)
t)
"\\>")
1 font-lock-keyword-face)
;; Macros similar to let, when, and while
(,(rx symbol-start
(or "let" "when" "while") "-"
(1+ (or (syntax word) (syntax symbol)))
symbol-end)
0 font-lock-keyword-face)
(,(concat
"\\<"
(regexp-opt
'("*1" "*2" "*3" "*agent*"
"*allow-unresolved-vars*" "*assert*" "*clojure-version*"
"*command-line-args*" "*compile-files*"
"*compile-path*" "*compiler-options*"
"*data-readers*" "*default-data-reader-fn*"
"*e" "*err*" "*file*" "*flush-on-newline*"
"*fn-loader*"
"*in*" "*math-context*" "*ns*" "*out*"
"*print-dup*" "*print-length*" "*print-level*"
"*print-meta*" "*print-namespace-maps*" "*print-readably*"
"*read-eval*" "*reader-resolver*" "*repl*" "*source-path*"
"*unchecked-math*"
"*use-context-classloader*" "*warn-on-reflection*")
t)
"\\>")
0 font-lock-builtin-face)
;; Dynamic variables - *something* or @*something*
(,(concat "\\(?:\\<\\|/\\)@?\\(\\*" clojure--sym-regexp "\\*\\)\\>")
1 font-lock-variable-name-face)
;; Global constants - nil, true, false
(,(concat
"\\<"
(regexp-opt
'("true" "false" "nil") t)
"\\>")
0 font-lock-constant-face)
;; Character literals - \1, \a, \newline, \u0000
(,(rx (group "\\" (or any
"newline" "space" "tab" "formfeed" "backspace"
"return"
(: "u" (= 4 (char "0-9a-fA-F")))
(: "o" (repeat 1 3 (char "0-7")))))
(or (not word) word-boundary))
1 'clojure-character-face)
;; lambda arguments - %, %&, %1, %2, etc
;; must come after character literals for \% to be handled properly
("\\<%[&1-9]*" (0 font-lock-variable-name-face))
;; namespace definitions: (ns foo.bar)
(,(concat "(\\<ns\\>[ \r\n\t]*"
;; Possibly metadata, shorthand and/or longhand
"\\(?:\\^?\\(?:{[^}]+}\\|:[^ \r\n\t]+[ \r\n\t]\\)[ \r\n\t]*\\)*"
;; namespace
"\\(" clojure--sym-regexp "\\)")
(1 font-lock-type-face))
;; TODO dedupe the code for matching of keywords, type-hints and unmatched symbols
;; keywords: {:oneword/ve/yCom|pLex.stu-ff 0}
(,(concat "\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "?\\)\\(/\\)"
"\\(" clojure--keyword-sym-regexp "\\)")
;; with ns
(1 'clojure-keyword-face)
(2 font-lock-type-face)
(3 'default)
(4 'clojure-keyword-face))
(,(concat "\\<\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "\\)")
;; without ns
(1 'clojure-keyword-face)
(2 'clojure-keyword-face))
;; type-hints: #^oneword
(,(concat "\\(#?\\^\\)\\(" clojure--sym-regexp "?\\)\\(/\\)\\(" clojure--sym-regexp "\\)")
(1 'default)
(2 font-lock-type-face)
(3 'default)
(4 'default))
(,(concat "\\(#?\\^\\)\\(" clojure--sym-regexp "\\)")
(1 'default)
(2 font-lock-type-face))
;; clojure symbols not matched by the previous regexps; influences CIDER's
;; dynamic syntax highlighting (CDSH). See https://git.io/vxEEA:
(,(concat "\\(" clojure--sym-regexp "?\\)\\(/\\)\\(" clojure--sym-regexp "\\)")
(1 font-lock-type-face)
;; 2nd and 3th matching groups can be font-locked to `nil' or `default'.
;; CDSH seems to kick in only for functions and variables referenced w/o
;; writing their namespaces.
(2 nil)
(3 nil))
(,(concat "\\(" clojure--sym-regexp "\\)")
;; this matching group must be font-locked to `nil' otherwise CDSH breaks.
(1 nil))
;; #_ and (comment ...) macros.
(clojure--search-comment-macro
1 (if (eq (char-after (match-beginning 0)) ?#)
'clojure-discard-face font-lock-comment-face)
t)
;; Highlight `code` marks, just like `elisp'.
(,(rx "`" (group-n 1 (optional "#'")
(+ (or (syntax symbol) (syntax word)))) "`")
(1 'font-lock-constant-face prepend))
;; Highlight [[var]] comments
(,(rx "[[" (group-n 1 (optional "#'")
(+ (or (syntax symbol) (syntax word)))) "]]")
(1 'font-lock-constant-face prepend))
;; Highlight escaped characters in strings.
(clojure-font-lock-escaped-chars 0 'bold prepend)
;; Highlight grouping constructs in regular expressions
(clojure-font-lock-regexp-groups
(1 'font-lock-regexp-grouping-construct prepend))))
"Default expressions to highlight in Clojure mode.")