Skip to content

Commit aabaa7d

Browse files
committed
Handle properly def* symbols, containing special chars
1 parent 7fc7c09 commit aabaa7d

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* [#302](https://github.com/clojure-emacs/clojure-mode/pull/302): Add new sexp navigation commands. `clojure-forward-logical-sexp` and `clojure-backward-logical-sexp` consider `^hints` and `#reader.macros` to be part of the sexp that follows them.
88
* [#303](https://github.com/clojure-emacs/clojure-mode/issues/303): Handle `boot` projects in `clojure-expected-ns`.
99

10+
### Bugs fixed
11+
12+
* Fix font-locking for def with special chars such as: `defn*`, `defspecial!`.
13+
1014
## 4.1.0 (20/06/2015)
1115

1216
### Changes

clojure-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ Called by `imenu--generic-function'."
380380
(2 font-lock-type-face nil t))
381381
;; Function definition (anything that starts with def and is not
382382
;; listed above)
383-
(,(concat "(\\(?:[a-z\.-]+/\\)?\\(def\[a-z\-\]*-?\\)"
383+
(,(concat "(\\(?:[a-z\.-]+/\\)?\\(def[^ \r\n\t]*\\)"
384384
;; Function declarations
385385
"\\>"
386386
;; Any whitespace

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ POS."
172172
(should (eq (clojure-test-face-at 2 5) 'font-lock-keyword-face))
173173
(should (eq (clojure-test-face-at 7 9) 'font-lock-function-name-face))))
174174

175+
(ert-deftest clojure-mode-syntax-table/custom-def-with-special-chars1 ()
176+
:tags '(fontification syntax-table)
177+
(clojure-test-with-temp-buffer "(defn* foo [x] x)"
178+
(should (eq (clojure-test-face-at 2 6) 'font-lock-keyword-face))
179+
(should (eq (clojure-test-face-at 8 10) 'font-lock-function-name-face))))
180+
181+
(ert-deftest clojure-mode-syntax-table/custom-def-with-special-chars2 ()
182+
:tags '(fontification syntax-table)
183+
(clojure-test-with-temp-buffer "(defsomething! foo [x] x)"
184+
(should (eq (clojure-test-face-at 2 14) 'font-lock-keyword-face))
185+
(should (eq (clojure-test-face-at 16 18) 'font-lock-function-name-face))))
186+
175187
(ert-deftest clojure-mode-syntax-table/lambda-params ()
176188
:tags '(fontification syntax-table)
177189
(clojure-test-with-temp-buffer "#(+ % %2 %3)"

0 commit comments

Comments
 (0)