Skip to content

Commit

Permalink
Handle properly def* symbols, containing special chars
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoBonacci committed Aug 3, 2015
1 parent 7fc7c09 commit aabaa7d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@
* [#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.
* [#303](https://github.com/clojure-emacs/clojure-mode/issues/303): Handle `boot` projects in `clojure-expected-ns`.

### Bugs fixed

* Fix font-locking for def with special chars such as: `defn*`, `defspecial!`.

## 4.1.0 (20/06/2015)

### Changes
Expand Down
2 changes: 1 addition & 1 deletion clojure-mode.el
Expand Up @@ -380,7 +380,7 @@ Called by `imenu--generic-function'."
(2 font-lock-type-face nil t))
;; Function definition (anything that starts with def and is not
;; listed above)
(,(concat "(\\(?:[a-z\.-]+/\\)?\\(def\[a-z\-\]*-?\\)"
(,(concat "(\\(?:[a-z\.-]+/\\)?\\(def[^ \r\n\t]*\\)"
;; Function declarations
"\\>"
;; Any whitespace
Expand Down
12 changes: 12 additions & 0 deletions test/clojure-mode-font-lock-test.el
Expand Up @@ -172,6 +172,18 @@ POS."
(should (eq (clojure-test-face-at 2 5) 'font-lock-keyword-face))
(should (eq (clojure-test-face-at 7 9) 'font-lock-function-name-face))))

(ert-deftest clojure-mode-syntax-table/custom-def-with-special-chars1 ()
:tags '(fontification syntax-table)
(clojure-test-with-temp-buffer "(defn* foo [x] x)"
(should (eq (clojure-test-face-at 2 6) 'font-lock-keyword-face))
(should (eq (clojure-test-face-at 8 10) 'font-lock-function-name-face))))

(ert-deftest clojure-mode-syntax-table/custom-def-with-special-chars2 ()
:tags '(fontification syntax-table)
(clojure-test-with-temp-buffer "(defsomething! foo [x] x)"
(should (eq (clojure-test-face-at 2 14) 'font-lock-keyword-face))
(should (eq (clojure-test-face-at 16 18) 'font-lock-function-name-face))))

(ert-deftest clojure-mode-syntax-table/lambda-params ()
:tags '(fontification syntax-table)
(clojure-test-with-temp-buffer "#(+ % %2 %3)"
Expand Down

0 comments on commit aabaa7d

Please sign in to comment.