Skip to content

Commit

Permalink
Fix font locking for non-alphanumeric chars in dynamic var names
Browse files Browse the repository at this point in the history
  • Loading branch information
cichli authored and bbatsov committed Feb 17, 2019
1 parent 1ccef7b commit 7943b29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bugs fixed

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

## 5.10.0 (2019-01-05)

### New features
Expand Down
3 changes: 2 additions & 1 deletion clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,8 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
"\\>")
0 font-lock-builtin-face)
;; Dynamic variables - *something* or @*something*
("\\(?:\\<\\|/\\)@?\\(\\*[a-z-]*\\*\\)\\>" 1 font-lock-variable-name-face)
(,(concat "\\(?:\\<\\|/\\)@?\\(\\*" clojure--sym-regexp "\\*\\)\\>")
1 font-lock-variable-name-face)
;; Global constants - nil, true, false
(,(concat
"\\<"
Expand Down
2 changes: 2 additions & 0 deletions test/clojure-mode-font-lock-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ POS."
(should (eq (clojure-test-face-at 2 11 "@*some-var*")
'font-lock-variable-name-face))
(should (eq (clojure-test-face-at 9 13 "some.ns/*var*")
'font-lock-variable-name-face))
(should (eq (clojure-test-face-at 1 11 "*some-var?*")
'font-lock-variable-name-face)))

(provide 'clojure-mode-font-lock-test)
Expand Down

0 comments on commit 7943b29

Please sign in to comment.