Closed gilch closed 6 years ago
Another problem along the same lines:
Hy-mode is intelligent enough to only indent one level (i.e. 2 spaces) after (if ...
, but treats (if-not x ...
as a function call and aligns the second row to the first:
;; current behavior
(if (x)
(y))
(if-not (x)
(y))
;; expected behavior
(if (x)
(y))
(if-not (x)
(y))
Do you have any thoughts on which forms should be indented special?
Right now, any form matching: \\(?:\\S +/\\)?\\(def\\|with-\\|with_\\|fn\\|lambda\\)
or exactly match one of:
(("for" . 1)
("for*" . 1)
("while" . 1)
("except" . 1)
("catch" . 1)
("let" . 1)
("if" . 1)
("when" . 1)
("unless" . 1))
will have the 'if-like' indentation.
Eg.
(lambda x
y)
(with-my-own-context x
y)
So adding if-not
and such variations are simple, what else though?
For example, I think as->
is a good candidate for special indentation, possibly also ap-pipe
.
I'm addressing the 2-space indentation as well.
The Hy Style Guide states that
The MELPA version of Hy-mode only gives me one space when I hit return or when I reformat a form. I shouldn't have to fight the editor to maintain the standard style.