Skip to content

Commit 313c3fa

Browse files
author
Bozhidar Batsov
committed
Fix a ns font-locking bug
Everything appearing after the word ns was treated as namespace (.e.g. [ns name]). Now we check if ns is preceded by a (.
1 parent 46a46d7 commit 313c3fa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clojure-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ Called by `imenu--generic-function'."
499499
;; foo.bar.baz
500500
("\\<^?\\([a-z][a-z0-9_-]+\\.\\([a-z][a-z0-9_-]*\\.?\\)+\\)" 1 font-lock-type-face)
501501
;; (ns namespace) - special handling for single segment namespaces
502-
(,(concat "\\<ns\\>[ \r\n\t]*"
502+
(,(concat "(\\<ns\\>[ \r\n\t]*"
503503
;; Possibly metadata
504504
"\\(?:\\^?{[^}]+}[ \r\n\t]*\\)*"
505505
;; namespace

test/clojure-mode-test.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ POS."
217217
(ert-deftest clojure-mode-syntax-table/ns-macro ()
218218
:tags '(fontification syntax-table)
219219
(should (eq (clojure-test-face-at 5 8 "(ns name)") 'font-lock-type-face))
220-
(should (eq (clojure-test-face-at 5 13 "(ns name.name)") 'font-lock-type-face)))
220+
(should (eq (clojure-test-face-at 5 13 "(ns name.name)") 'font-lock-type-face))
221+
(should (eq (clojure-test-face-at 1 10 "[ns name]") nil)))
221222

222223
(provide 'clojure-mode-test)
223224

0 commit comments

Comments
 (0)