Skip to content

Commit 214bf02

Browse files
authored
Make indentation of special arguments customisable (#582)
Allow control of the indentation of special arguments through a defcustom. - introduces clojure-special-arg-indent-factor, which is used as a factor of lisp-body-ident to indent special arguments. Defaults to 2, the currently hard coded value for this.
1 parent ef04784 commit 214bf02

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

clojure-mode-indentation-test.el

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,51 @@ DESCRIPTION is a string with the description of the spec."
233233
(ala/bala top
234234
|one)"))
235235

236+
(describe "specify an indentation for symbol"
237+
(put-clojure-indent 'cala 1)
238+
239+
(when-indenting-with-point-it "should handle a symbol with ns"
240+
"
241+
(cala top
242+
|one)"
243+
"
244+
(cala top
245+
|one)")
246+
(when-indenting-with-point-it "should handle special arguments"
247+
"
248+
(cala
249+
|top
250+
one)"
251+
"
252+
(cala
253+
|top
254+
one)"))
255+
(describe "should respect special argument indentation"
256+
:var (clojure-special-arg-indent-factor)
257+
(before-each
258+
(setq clojure-special-arg-indent-factor 1))
259+
(after-each
260+
(setq clojure-special-arg-indent-factor 2))
261+
262+
(put-clojure-indent 'cala 1)
263+
264+
(when-indenting-with-point-it "should handle a symbol with ns"
265+
"
266+
(cala top
267+
|one)"
268+
"
269+
(cala top
270+
|one)")
271+
(when-indenting-with-point-it "should handle special arguments"
272+
"
273+
(cala
274+
|top
275+
one)"
276+
"
277+
(cala
278+
|top
279+
one)"))
280+
236281
(describe "we can pass a lambda to explicitly set the column"
237282
(put-clojure-indent 'arsymbol (lambda (indent-point state) 0))
238283

0 commit comments

Comments
 (0)