Skip to content

Commit 91d2a0a

Browse files
committed
Merge pull request #326 from Malabarba/master
Font-lock namespaced keywords
2 parents 96e3e3f + 3c0bdf7 commit 91d2a0a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

clojure-mode.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,10 @@ Called by `imenu--generic-function'."
454454
0 font-lock-constant-face)
455455
;; Character literals - \1, \a, \newline, \u0000
456456
("\\\\\\([[:punct:]]\\|[a-z0-9]+\\>\\)" 0 'clojure-character-face)
457+
;; foo/ Foo/ @Foo/ /FooBar
458+
("\\(?:\\<:?\\|\\.\\)@?\\([a-zA-Z][.a-zA-Z0-9$_-]*\\)/" 1 font-lock-type-face)
457459
;; Constant values (keywords), including as metadata e.g. ^:static
458-
("\\<^?\\(:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)\\)" 1 'clojure-keyword-face)
460+
("\\<^?\\(:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)\\)" 1 'clojure-keyword-face append)
459461
;; Java interop highlighting
460462
;; CONST SOME_CONST (optionally prefixed by /)
461463
("\\(?:\\<\\|/\\)\\([A-Z]+\\|\\([A-Z]+_[A-Z1-9_]+\\)\\)\\>" 1 font-lock-constant-face)
@@ -472,8 +474,6 @@ Called by `imenu--generic-function'."
472474
;; namespace
473475
"\\([a-z0-9-]+\\)")
474476
(1 font-lock-type-face nil t))
475-
;; foo/ Foo/ @Foo/ /FooBar
476-
("\\(?:\\<\\|\\.\\)@?\\([a-zA-Z][a-zA-Z0-9$_-]*\\)/" 1 font-lock-type-face)
477477
;; fooBar
478478
("\\(?:\\<\\|/\\)\\([a-z]+[A-Z]+[a-zA-Z0-9$]*\\>\\)" 1 'clojure-interop-method-face)
479479
;; Highlight `code` marks, just like `elisp'.

test/clojure-mode-font-lock-test.el

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,16 @@ POS."
101101

102102
(ert-deftest clojure-mode-syntax-table/fontify-clojure-keyword ()
103103
:tags '(fontification syntax-table)
104-
(should (eq (clojure-test-face-at 2 11 "{:something 20}") 'clojure-keyword-face)))
104+
(should (equal (clojure-test-face-at 2 11 "{:something 20}") '(clojure-keyword-face))))
105+
106+
(ert-deftest clojure-mode-syntax-table/fontify-namespaced-keyword ()
107+
:tags '(fontification syntax-table)
108+
(should (equal (clojure-test-face-at 2 2 "{:alias/some 20}") '(clojure-keyword-face)))
109+
(should (equal (clojure-test-face-at 3 7 "{:alias/some 20}") '(font-lock-type-face clojure-keyword-face)))
110+
(should (equal (clojure-test-face-at 8 12 "{:alias/some 20}") '(clojure-keyword-face)))
111+
(should (equal (clojure-test-face-at 2 2 "{:a.ias/some 20}") '(clojure-keyword-face)))
112+
(should (equal (clojure-test-face-at 3 7 "{:a.ias/some 20}") '(font-lock-type-face clojure-keyword-face)))
113+
(should (equal (clojure-test-face-at 8 12 "{:a.ias/some 20}") '(clojure-keyword-face))))
105114

106115
(ert-deftest clojure-mode-syntax-table/type ()
107116
:tags '(fontification syntax-table)
@@ -229,7 +238,7 @@ POS."
229238
:tags '(fontification syntax-table)
230239
(clojure-test-with-temp-buffer "^:meta-data"
231240
(should (eq (clojure-test-face-at 1 1) nil))
232-
(should (eq (clojure-test-face-at 2 11) 'clojure-keyword-face))))
241+
(should (equal (clojure-test-face-at 2 11) '(clojure-keyword-face)))))
233242

234243
(ert-deftest clojure-mode-syntax-table/characters ()
235244
:tags '(fontification syntax-table)

0 commit comments

Comments
 (0)