Skip to content

Commit e931d08

Browse files
authored
Merge pull request #510 from carlosgeos/fix-comment-in-445
[Fix comment in #445] Proper font lock in (s/def ::keyword)
2 parents 6d8e5a6 + 7c548aa commit e931d08

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Bugs fixed
66

77
* Dynamic vars whose names contain non-alphanumeric characters are now font-locked correctly.
8+
* [#445 (comment)](https://github.com/clojure-emacs/clojure-mode/issues/445#issuecomment-340460753): Proper font lock for namespaced keywords like for example `(s/def ::keyword)`
89

910
## 5.10.0 (2019-01-05)
1011

clojure-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
785785
"[ \r\n\t]*"
786786
;; Possibly type or metadata
787787
"\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*"
788-
"\\(\\sw+\\)?")
788+
(concat "\\(" clojure--sym-regexp "\\)?"))
789789
(1 font-lock-keyword-face)
790790
(2 font-lock-function-name-face nil t))
791791
;; (fn name? args ...)

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,13 @@ POS."
709709
(should (eq (clojure-test-face-at 2 4) 'font-lock-type-face))
710710
(should (eq (clojure-test-face-at 5 5) nil))
711711
(should (eq (clojure-test-face-at 6 11) 'font-lock-keyword-face))
712-
(should (eq (clojure-test-face-at 13 15) 'font-lock-function-name-face))))
712+
(should (eq (clojure-test-face-at 13 15) 'font-lock-function-name-face)))
713+
(clojure-test-with-temp-buffer "(s/def ::keyword)"
714+
(should (eq (clojure-test-face-at 2 2) 'font-lock-type-face))
715+
(should (eq (clojure-test-face-at 3 3) nil))
716+
(should (eq (clojure-test-face-at 4 6) 'font-lock-keyword-face))
717+
(should (eq (clojure-test-face-at 8 16) 'clojure-keyword-face))))
718+
713719

714720
(ert-deftest clojure-mode-syntax-table/variable-def ()
715721
:tags '(fontification syntax-table)

0 commit comments

Comments
 (0)