Skip to content
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

formatting custom macro uses is off #63

Closed
eliben opened this issue Mar 7, 2016 · 3 comments
Closed

formatting custom macro uses is off #63

eliben opened this issue Mar 7, 2016 · 3 comments

Comments

@eliben
Copy link

eliben commented Mar 7, 2016

Thanks for cljfmt - coming from other languages with such tools, this feels essential

When I define a new macro:

(defmacro when-valid
  ...)

And then use it, it makes sense for me to keep some of the arguments on the same line with the macro invocation:

(when-valid var set-of-rules
  (do 1...)
  (do 2...))

However, cljfmt will reformat this as follows:

(when-valid var set-of-rules
            (do 1...)
            (do 2...))

Because it wants to line up all the "call" arguments together, similarly to what's done for function calls. But for many macros it's inappropriate, since they have two logically separate sets of arguments

@expez
Copy link

expez commented Mar 7, 2016

This probably won't be general enough until cljfmt adds support for an indentation spec.

This would however force cljfmt into doing multiple passes (one to collect metadata to indent properly and then one to actually apply the rules).

@weavejester
Copy link
Owner

You can customise the indentation via your project file, which is documented in the README.

Using var metadata to define indentation is covered by issue #49.

@eliben
Copy link
Author

eliben commented Mar 7, 2016

Thanks for the quick response

@eliben eliben closed this as completed Mar 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants