From 5cbaa0d9dcac2b46c3c67198e6fe9d71d9a4ec2e Mon Sep 17 00:00:00 2001 From: yuhan0 Date: Thu, 26 Mar 2020 09:26:55 +0800 Subject: [PATCH 1/3] Fix character face regexp --- clojure-mode.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clojure-mode.el b/clojure-mode.el index c9a419f4..7bcb1abf 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -868,7 +868,13 @@ any number of matches of `clojure--sym-forbidden-rest-chars'.")) "\\>") 0 font-lock-constant-face) ;; Character literals - \1, \a, \newline, \u0000 - ("\\\\\\([[:punct:]]\\|[a-z0-9]+\\>\\)" 0 'clojure-character-face) + (,(rx "\\" (or any + "newline" "space" "tab" "formfeed" "backspace" + "return" + (: "u" (= 4 (char "0-9a-fA-F"))) + (: "o" (repeat 1 3 (char "0-7")))) + word-boundary) + 0 'clojure-character-face) ;; namespace definitions: (ns foo.bar) (,(concat "(\\[ \r\n\t]*" From f19a446df775334db351684b2f4912f1de38fd3c Mon Sep 17 00:00:00 2001 From: yuhan0 Date: Thu, 26 Mar 2020 09:44:59 +0800 Subject: [PATCH 2/3] Add more tests for character face --- test/clojure-mode-font-lock-test.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/clojure-mode-font-lock-test.el b/test/clojure-mode-font-lock-test.el index a45e3de1..23dade2b 100644 --- a/test/clojure-mode-font-lock-test.el +++ b/test/clojure-mode-font-lock-test.el @@ -884,15 +884,30 @@ DESCRIPTION is the description of the spec." ("\\a" (1 2 clojure-character-face)) + ("\\A" + (1 2 clojure-character-face)) + ("\\newline" (1 8 clojure-character-face)) + ("\\abc" + (1 4 nil)) + + ("\\newlin" + (1 7 nil)) + + ("\\newlinex" + (1 9 nil)) + ("\\1" (1 2 clojure-character-face)) ("\\u0032" (1 6 clojure-character-face)) + ("\\o127" + (1 4 clojure-character-face)) + ("\\+" (1 2 clojure-character-face)) @@ -903,6 +918,12 @@ DESCRIPTION is the description of the spec." (1 2 clojure-character-face)) ("\\;" + (1 2 clojure-character-face)) + + ("\\Ω" + (1 2 clojure-character-face)) + + ("\\ク" (1 2 clojure-character-face))) (when-fontifying-it "should handle referred vars" From d8e9e49e2976543708d7bc12e2304a4f75dde39f Mon Sep 17 00:00:00 2001 From: yuhan0 Date: Thu, 26 Mar 2020 22:15:10 +0800 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8d98cc0..2913031d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bugs fixed +* [#547](https://github.com/clojure-emacs/clojure-mode/issues/547): Fix font-lock regex for character literals for uppercase chars and other symbols. * [#556](https://github.com/clojure-emacs/clojure-mode/issues/556): Fix renaming of ns aliases containing regex characters. * [#555](https://github.com/clojure-emacs/clojure-mode/issues/555): Fix ns detection for ns forms with complex metadata. * [#550](https://github.com/clojure-emacs/clojure-mode/issues/550): Fix `outline-regexp` so `outline-insert-heading` behaves correctly.