Skip to content

Commit e2c6a4a

Browse files
rpkarlssonbbatsov
authored andcommitted
[Fix #496] Highlight [[var]] style comments
1 parent e898a94 commit e2c6a4a

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### New features
6+
7+
* [#496](https://github.com/clojure-emacs/clojure-mode/issues/496): Highlight `[[wikilinks]]` in comments
8+
59
### Bugs fixed
610

711
* Dynamic vars whose names contain non-alphanumeric characters are now font-locked correctly.

clojure-mode.el

+4
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,10 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
911911
(,(rx "`" (group-n 1 (optional "#'")
912912
(+ (or (syntax symbol) (syntax word)))) "`")
913913
(1 'font-lock-constant-face prepend))
914+
;; Highlight [[var]] comments
915+
(,(rx "[[" (group-n 1 (optional "#'")
916+
(+ (or (syntax symbol) (syntax word)))) "]]")
917+
(1 'font-lock-constant-face prepend))
914918
;; Highlight escaped characters in strings.
915919
(clojure-font-lock-escaped-chars 0 'bold prepend)
916920
;; Highlight grouping constructs in regular expressions

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

+17
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,23 @@ POS."
110110
(should (equal (clojure-test-face-at 4 5 "#\"a\\bc\\n\"")
111111
'(bold font-lock-string-face))))
112112

113+
(ert-deftest clojure-mode-syntax-table/stuff-in-double-brackets ()
114+
:tags '(fontification syntax-table)
115+
(should (equal (clojure-test-face-at 1 3 "\"[[#'s/trim]]\"")
116+
font-lock-string-face))
117+
(should (equal (clojure-test-face-at 4 11 "\"[[#'s/trim]]\"")
118+
'(font-lock-constant-face font-lock-string-face)))
119+
(should (equal (clojure-test-face-at 12 14 "\"[[#'s/trim]]\"")
120+
font-lock-string-face))
121+
(should (equal (clojure-test-face-at 1 1 ";[[#'s/trim]]")
122+
font-lock-comment-delimiter-face))
123+
(should (equal (clojure-test-face-at 2 3 ";[[#'s/trim]]")
124+
font-lock-comment-face))
125+
(should (equal (clojure-test-face-at 4 11 ";[[#'s/trim]]")
126+
'(font-lock-constant-face font-lock-comment-face)))
127+
(should (equal (clojure-test-face-at 12 13 ";[[#'s/trim]]")
128+
font-lock-comment-face)))
129+
113130
(ert-deftest clojure-mode-syntax-table/fontify-let-when-while-type-forms ()
114131
:tags '(fontification syntax-table)
115132
(should (equal (clojure-test-face-at 2 11 "(when-alist [x 1]\n ())")

0 commit comments

Comments
 (0)