diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e035611..9eecf138 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/clojure-mode.el b/clojure-mode.el index d7e1564c..7c050a04 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -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)) diff --git a/test/clojure-mode-indentation-test.el b/test/clojure-mode-indentation-test.el index 7fcc9389..fbdb5f41 100644 --- a/test/clojure-mode-indentation-test.el +++ b/test/clojure-mode-indentation-test.el @@ -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] @@ -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))