Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1072,12 +1072,13 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
;; 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)
;; (2 'clojure-keyword-face)
(3 'default)
(4 'clojure-keyword-face))
(,(concat "\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "\\)")
(,(concat "\\<\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "\\)")
;; without ns
(1 'clojure-keyword-face)
(2 'clojure-keyword-face))

Expand Down
25 changes: 24 additions & 1 deletion test/clojure-mode-font-lock-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ DESCRIPTION is the description of the spec."
(9 10 nil)
(11 16 nil))

("(colons:are:okay)"
(2 16 nil))

("(some-ns/colons:are:okay)"
(2 8 font-lock-type-face)
(9 24 nil))

("(oneword/ve/yCom|pLex.stu-ff)"
(2 8 font-lock-type-face)
(9 10 nil)
Expand Down Expand Up @@ -715,6 +722,19 @@ DESCRIPTION is the description of the spec."
(10 10 default)
(11 30 clojure-keyword-face)))

(when-fontifying-it "should handle keywords with colons"
(":a:a"
(1 4 clojure-keyword-face))

(":a:a/:a"
(1 7 clojure-keyword-face))

("::a:a"
(1 5 clojure-keyword-face))

("::a.a:a"
(1 7 clojure-keyword-face)))

(when-fontifying-it "should handle very complex keywords"
(" :ve/yCom|pLex.stu-ff"
(3 4 font-lock-type-face)
Expand Down Expand Up @@ -824,7 +844,10 @@ DESCRIPTION is the description of the spec."
(when-fontifying-it "should handle variables defined with def"
("(def foo 10)"
(2 4 font-lock-keyword-face)
(6 8 font-lock-variable-name-face)))
(6 8 font-lock-variable-name-face))
("(def foo:bar 10)"
(2 4 font-lock-keyword-face)
(6 12 font-lock-variable-name-face)))

(when-fontifying-it "should handle variables definitions of type string"
("(def foo \"hello\")"
Expand Down