@@ -401,42 +401,31 @@ Because `(e...)` is the 4th (index `3`) at form depth `1`.
401
401
402
402
#### Block rules
403
403
404
- The ` :block ` rule supports indenting to the first form argument. It
405
- has a single rule type argument:
404
+ The ` :block ` rule works like the ` :inner ` rule under some
405
+ circumstances, and like a normal list form under others. It takes one
406
+ argument:
406
407
407
- * ` line-arg-count-threshold ` -
408
- when there are more than this many form arguments on the same line
409
- as the form symbol, eligible form arguments on subsequent lines are
410
- indented to align with the first form argument. Otherwise, two space
411
- inner indentation is applied.
408
+ * ` line-threshold-index ` -
409
+ if the argument at this index starts a new line, all following lines
410
+ will be indented by a constant 2 spaces. Any other lines are
411
+ indented normally.
412
412
413
- For indent rule :
413
+ For example :
414
414
415
415
``` clojure
416
416
{foo [[:block 0 ]]}
417
417
```
418
418
419
- The single argument ` bar ` on the same line as ` foo ` breaks the
420
- threshold of ` 0 ` and indents eligible form arguments on subsequent
421
- lines to ` bar ` :
422
-
419
+ If the argument at index 0 (the first argument) does not start a new
420
+ line, the form is indented as normal:
423
421
424
422
``` clojure
425
423
(foo bar (foo bar
426
424
baz == formats to => baz
427
425
bang) bang)
428
426
```
429
427
430
- The two arguments ` bar baz ` on the same line as ` foo ` also breaks the
431
- threshold of ` 0 ` and invokes indentation to the first argument:
432
-
433
- ``` clojure
434
- (foo bar baz == formats to => (foo bar baz
435
- bang) bang)
436
- ```
437
-
438
- No arguments on the same line as ` foo ` does not break the threshold of
439
- ` 0 ` , so 2 space inner indentation is applied:
428
+ If it does, the lines are indented with a constant 2 spaces:
440
429
441
430
``` clojure
442
431
(foo (foo
@@ -445,29 +434,38 @@ baz baz
445
434
bang) bang)
446
435
```
447
436
448
- For indent rule:
437
+ To give another example
449
438
450
439
``` clojure
451
440
{foo [[:block 1 ]]}
452
441
```
453
442
454
- The single arg ` bar ` on the same line as ` foo ` does not break the
455
- threshold of ` 1 ` so we get inner indentation :
443
+ This time we're looking at the argument at index 1 ( the second
444
+ argument). If it starts a new line, the indent is constant :
456
445
457
446
``` clojure
458
447
(foo bar (foo bar
459
448
baz == formats to => baz
460
449
bang) bang)
461
450
```
462
451
463
- Two args ` bar baz ` on the same line as ` foo ` breaks the threshold of
464
- ` 1 ` so we get first argument aligned indentation :
452
+ But if it does not, start a new line, normal indentation rules are
453
+ used instead :
465
454
466
455
``` clojure
467
456
(foo bar baz == formats to => (foo bar baz
468
457
bang) bang)
469
458
```
470
459
460
+ Any lines before the threshold are always indented normally:
461
+
462
+ ``` clojure
463
+ (foo (foo
464
+ bar bar
465
+ baz == formats to => baz
466
+ bang) bang)
467
+ ```
468
+
471
469
#### Multiple rules
472
470
473
471
Multiple rules can be specified. Picking up from our previous ` letfn `
0 commit comments