Skip to content

Commit

Permalink
Merge pull request #316 from BrunoBonacci/fix-font-locking
Browse files Browse the repository at this point in the history
Fixed font-locking for def* with support of special chars
  • Loading branch information
bbatsov committed Aug 3, 2015
2 parents 82e75a0 + aabaa7d commit 031f280
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 @@ -13,6 +13,10 @@
* [#310](https://github.com/clojure-emacs/clojure-mode/issues/310) and [#311](https://github.com/clojure-emacs/clojure-mode/issues/311) Fix `clojure-expected-ns` in multi-source projects.
* [#307](https://github.com/clojure-emacs/clojure-mode/issues/307): Don't highlight `handle` and `handler-case` as keywords.

### 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 @@ -193,6 +193,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 031f280

Please sign in to comment.