Skip to content

Commit

Permalink
Fix multi-airty indention of deftype & defrecord (clojure-emacs#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpoweski committed Jun 26, 2016
1 parent 6d0dea4 commit 53b1ab4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
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

* [#389](https://github.com/clojure-emacs/clojure-mode/issues/389): Fixed the indentation of `defrecord` and `deftype` multiple airity protocol forms.

## 5.5.0 (2016-06-25)

### New features
Expand Down
4 changes: 2 additions & 2 deletions clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1313,8 +1313,8 @@ work). To set it from Lisp code, use
(as-> 2)

(reify '(:defn (1)))
(deftype '(2 nil nil (1)))
(defrecord '(2 nil nil (1)))
(deftype '(2 nil nil (:defn)))
(defrecord '(2 nil nil (:defn)))
(defprotocol '(1 (:defn)))
(extend 1)
(extend-protocol '(1 :defn))
Expand Down
18 changes: 18 additions & 0 deletions test/clojure-mode-indentation-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ values of customisable variables."
([item a]
(* a (:qty item)))))")

(def-full-indent-test deftype-allow-multiarity
"(deftype Banana []
Fruit
(subtotal
([item]
(* 158 (:qty item)))
([item a]
(* a (:qty item)))))")

(def-full-indent-test defprotocol
"(defprotocol IFoo
(foo [this]
Expand Down Expand Up @@ -326,6 +335,15 @@ values of customisable variables."
SomeType (assoc [_ x]
(.assoc pretty x 10)))")

(def-full-indent-test defrecord-allow-multiarity
"(defrecord Banana []
Fruit
(subtotal
([item]
(* 158 (:qty item)))
([item a]
(* a (:qty item)))))")

(def-full-indent-test letfn
"(letfn [(f [x]
(* x 2))
Expand Down

0 comments on commit 53b1ab4

Please sign in to comment.