You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as-> indentation spec should not be 2 It creates the following indentation, which is not desirable, in my eyes. Note how the two lines under it are indented differently.
(-> 123
(+ 1)
(as-> x
(+ x 1)
(- 1 x)))
I'm not exactly sure what indentation spec to use though. The problem, of course, is that if you want to use as-> without a surrounding threading macro, and you don't have the two first argument on the first line, the second should be indented differently than the rest. However, I think the situation above is more common than that.
I think pretty much any macro with an indent spec will be poorly indented by Emacs inside a threading macro. I'm not sure changing the spec for as-> is the best solution to that.
I agree with @Malabarba. There's little we can do in such situations, as the indentation specs reflect the typical usage of the forms. No one else has complained about this problem, so I guess it's safe to assume it's not very common.
For completeness sake: When running cljfmt on our project it brings up a bunch of examples of exactly what @oskarkv mentioned. Looking at our codebase, we always and only use as-> within another threading macro, following the advice from https://stuartsierra.com/2018/07/15/clojure-donts-thread-as
Activity
Malabarba commentedon Oct 12, 2017
I think pretty much any macro with an indent spec will be poorly indented by Emacs inside a threading macro. I'm not sure changing the spec for
as->is the best solution to that.bbatsov commentedon Jul 16, 2019
I agree with @Malabarba. There's little we can do in such situations, as the indentation specs reflect the typical usage of the forms. No one else has complained about this problem, so I guess it's safe to assume it's not very common.
kommen commentedon Aug 5, 2019
For completeness sake: When running
cljfmton our project it brings up a bunch of examples of exactly what @oskarkv mentioned. Looking at our codebase, we always and only useas->within another threading macro, following the advice from https://stuartsierra.com/2018/07/15/clojure-donts-thread-as