Skip to content

as-> indentation spec should not be 2 #433

Closed

Description

@oskarkv

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.

Activity

  1. Malabarba commented on Oct 12, 2017

    @Malabarba
    Member

    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.

  2. bbatsov commented on Jul 16, 2019

    @bbatsov
    Member

    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.

  3. kommen commented on Aug 5, 2019

    @kommen
    Contributor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions