diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bfe1ff5..8ac88681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### New features + +* [#496](https://github.com/clojure-emacs/clojure-mode/issues/496): Highlight `[[wikilinks]]` in comments + ### Bugs fixed * Dynamic vars whose names contain non-alphanumeric characters are now font-locked correctly. diff --git a/clojure-mode.el b/clojure-mode.el index 5d06272c..fae4d2c6 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -911,6 +911,10 @@ any number of matches of `clojure--sym-forbidden-rest-chars'.")) (,(rx "`" (group-n 1 (optional "#'") (+ (or (syntax symbol) (syntax word)))) "`") (1 'font-lock-constant-face prepend)) + ;; Highlight [[var]] comments + (,(rx "[[" (group-n 1 (optional "#'") + (+ (or (syntax symbol) (syntax word)))) "]]") + (1 'font-lock-constant-face prepend)) ;; Highlight escaped characters in strings. (clojure-font-lock-escaped-chars 0 'bold prepend) ;; Highlight grouping constructs in regular expressions diff --git a/test/clojure-mode-font-lock-test.el b/test/clojure-mode-font-lock-test.el index 48e9b4c9..52fa6016 100644 --- a/test/clojure-mode-font-lock-test.el +++ b/test/clojure-mode-font-lock-test.el @@ -110,6 +110,23 @@ POS." (should (equal (clojure-test-face-at 4 5 "#\"a\\bc\\n\"") '(bold font-lock-string-face)))) +(ert-deftest clojure-mode-syntax-table/stuff-in-double-brackets () + :tags '(fontification syntax-table) + (should (equal (clojure-test-face-at 1 3 "\"[[#'s/trim]]\"") + font-lock-string-face)) + (should (equal (clojure-test-face-at 4 11 "\"[[#'s/trim]]\"") + '(font-lock-constant-face font-lock-string-face))) + (should (equal (clojure-test-face-at 12 14 "\"[[#'s/trim]]\"") + font-lock-string-face)) + (should (equal (clojure-test-face-at 1 1 ";[[#'s/trim]]") + font-lock-comment-delimiter-face)) + (should (equal (clojure-test-face-at 2 3 ";[[#'s/trim]]") + font-lock-comment-face)) + (should (equal (clojure-test-face-at 4 11 ";[[#'s/trim]]") + '(font-lock-constant-face font-lock-comment-face))) + (should (equal (clojure-test-face-at 12 13 ";[[#'s/trim]]") + font-lock-comment-face))) + (ert-deftest clojure-mode-syntax-table/fontify-let-when-while-type-forms () :tags '(fontification syntax-table) (should (equal (clojure-test-face-at 2 11 "(when-alist [x 1]\n ())")