Skip to content

Commit e365b2d

Browse files
author
Bozhidar Batsov
committed
Improve font-locking of punctuation characters
1 parent 73f550d commit e365b2d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

clojure-mode.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ Called by `imenu--generic-function'."
477477
"\\>")
478478
0 font-lock-constant-face)
479479
;; Character literals - \1, \a, \newline, \u0000
480-
;; FIXME: handle properly punctuation characters (commas after a character are problematic)
481-
("\\\\[a-z0-9]+\\>" 0 'clojure-character-face)
480+
;; FIXME: handle properly some punctuation characters (like commas and semicolumns)
481+
("\\\\\\([[:punct:]]\\|[a-z0-9]+\\)\\>" 0 'clojure-character-face)
482482
;; Constant values (keywords), including as metadata e.g. ^:static
483483
("\\<^?\\(:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)\\)" 1 'clojure-keyword-face)
484484
;; cljx annotations (#+clj and #+cljs)

test.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
minnow))
1818

1919
;; character literals
20-
[\a \newline \,, dfdfdf \.]
20+
[\a \newline \u0032 \/ \+ \,, \;]
2121

2222
;; cljx
2323
(defn x-to-string

test/clojure-mode-test.el

+3-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ POS."
195195
(should (eq (clojure-test-face-at 1 2 "\\a") 'clojure-character-face))
196196
(should (eq (clojure-test-face-at 1 8 "\\newline") 'clojure-character-face))
197197
(should (eq (clojure-test-face-at 1 2 "\\1") 'clojure-character-face))
198-
(should (eq (clojure-test-face-at 1 6 "\\u0032") 'clojure-character-face)))
198+
(should (eq (clojure-test-face-at 1 6 "\\u0032") 'clojure-character-face))
199+
(should (eq (clojure-test-face-at 1 2 "\\+") 'clojure-character-face))
200+
(should (eq (clojure-test-face-at 1 2 "\\.") 'clojure-character-face)))
199201

200202
(ert-deftest clojure-mode-syntax-table/cljx ()
201203
:tags '(fontification syntax-table)

0 commit comments

Comments
 (0)