Skip to content

Commit 0c34241

Browse files
author
Bozhidar Batsov
committed
Refine keyword literals font-locking
1 parent d7c28eb commit 0c34241

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

clojure-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ Called by `imenu--generic-function'."
489489
;; FIXME: handle properly punctuations characters (commas after a character are problematic)
490490
("\\\\[a-z0-9]+\\>" 0 'clojure-character-face)
491491
;; Constant values (keywords), including as metadata e.g. ^:static
492-
("\\<^?:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)" 0 'clojure-keyword-face)
492+
("\\<^?\\(:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)\\)" 1 'clojure-keyword-face)
493493
;; cljx annotations (#+clj and #+cljs)
494494
("#\\+cljs?\\>" 0 font-lock-preprocessor-face)
495495
;; Java interop highlighting

test/clojure-mode-test.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ POS."
171171
:tags '(fontification syntax-table)
172172
(should (eq (clojure-test-face-at 4 8 "(= false x)") 'font-lock-constant-face)))
173173

174+
(ert-deftest clojure-mode-syntax-table/keyword-meta ()
175+
:tags '(fontification syntax-table)
176+
(clojure-test-with-temp-buffer "^:meta-data"
177+
(should (eq (clojure-test-face-at 1 1) nil))
178+
(should (eq (clojure-test-face-at 2 11) 'clojure-keyword-face))))
179+
174180
(ert-deftest clojure-mode-syntax-table/characters ()
175181
:tags '(fontification syntax-table)
176182
(should (eq (clojure-test-face-at 1 2 "\\a") 'clojure-character-face))

0 commit comments

Comments
 (0)