-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indentation inference for defmacros #777
Comments
Another rule of thumb, is that if something is called approximately (For these ones, it's safer to do this only if the custom macro's arglists are equal or a subset to those of their clojure.core counterpart) |
Yeah, that'd be fine. That's similar to how SLIME used to work out indentation when it wasn't specified - by relying on the the names of some params (I think |
You can check this out for some inspiration https://github.com/slime/slime/blob/master/contrib/slime-cl-indent.el |
(IDK if this had been talked about before)
Given an arbitrary macro that lacks
:style/indent
metadata, e.g.(defmacro fact [& forms]
, I'd find it most practical that CIDER inferred a sensibleindent
value for it.A sensible rule of thumb is:
For instance,
[a b & c]
has two arguments before&
, so the inferred indent should be2
.There occasionally exist macros without
&
, e.g.:For those, we can devise a similar rule of thumb:
(or
forms
,tail
, similar words)So that foo would have an indent of
1
.I understand that this is not quite 'pure' in approach. But my experience over the years is that very few people, even among CIDER users, will remember to add the metadata manually.
Ultimately, users can of course always add metadata, which would override any inference.
WDYT?
Cheers - V
The text was updated successfully, but these errors were encountered: