Closed ekaschalk closed 6 years ago
The ,
special form for tuples should align args like a function call.
Current
(, 1
2
3)
Expected
(, 1
2
3)
Fixed the tuple alignment. I've been refactoring the indentation, almost all clean now.
6f1ac071b71865ac0f130b0a679aa7120b7af65e
Smartparens doesn't duplicate it anymore, but, the `
is getting paired and indented like a bracket. For example,
(if b
`x
`y)
Expected
(if b
`x
`y)
Fixed with d5cf1890c938a17dcef37b0d70230ab7e2dcfe03
I've finished rewriting the indentation, should be solid now.
Found an issue occuring only when starting a form with exactly .-
:
(.-a d
e)
Expected:
(.-a d
e)
Hy's if
is variadic, (like in Arc Lisp). When taking more than three arguments, it needs to be indented like Clojure's cond
, instead of Clojure's if
.
Current
(if 1 2
3 4
5 6
7 8
9)
Expected
(if 1 2
3 4
5 6
7 8
9)
This used to work both ways, like a call if 1 2 were on the same line, and like a defn if 1 was by itself, e.g.
(if 1 2
3)
(if 1
2
3)
In other Lisps, it's normal to indent if
just like a function call. Emacs is unusual because it dedents the else clasue. And Clojure is unusual because it dedents both then and else clauses.
I personally think it would be fine if if
were indented just like a regular call all the time. It doesn't have an implicit-do body. But in either case, the cond
-like form should not get the dedent.
The ,
is just a symbol, but even in []
and {}
, it gets indented like a tuple special form--
[, 1
2 3]
{, 1
2 3}
Expected
[, 1
2 3]
{, 1
2 3}
Tuple indentation fixed with 57078d7a3adbff17dd7ed9fcfe2326d2fe02d1ee If treated as function with eb808be9b00de514a470ad96c5694cef633204e8 Tag macro indentation with c26bc900be071dbe2488c12c787d953c21232ed8
There was no bug with .-
symbols.
If you have preference for the final case I know how to implement that.
I believe indentation to be settled now. Going to close this.
Sets seem to throw off indentation
(foo #{}
1
2)
expected
(foo #{}
1
2)
Fixed. Before tag macros would indent 1 past the hash, they now indent at the hash as seen in the set literals.
Forms opening with another form throw normal indentation off.
((if pred f g) a
b)
Expected to follow standard indentation rules, instead always indents at the opening. Believe it is because it indents parenthesis like a bracket-like.
Edit: Resolved in 620e968a9f51c91b2704729134bf3a33b30f0d97
@gilch @Kodiologist
I've rewritten hy-mode indentation taking from Clojure. We now have:
Let me know if any bugs have popped up, it's passing on all my files.
Also let me know if any remaining requests for indentation, in particular adjusting the specform to indent things like
as->
,ap-pipe/if/...
and so on.