Does Calva attempt to follow Emacs/Cider's indentation specs? https://docs.cider.mx/cider/indent_spec.html I noticed that it indents "special" args differently when they are on separate lines:
;; Emacs
(let
[x 0]
(inc x))
;; Calva:
(let
[x 0]
(inc x))
Calva does not adhere to those yet. I don’t know what it would take, actually. Does let
really specify indentation, btw?
Ah, I'm guessing it just shells out to cljfmt
which has its own entirely different system
See the link above, let
has a spec of [1] which means the first argument is treated specially and the rest as "body" arguments
Honestly I'm not a fan of the 4-space indents, what's more important is consistency between different editors in our team - if Calva is just using straight cljfmt it might be easier to get Emacs to follow that instead 🙂
It looks like this when I check it out:
(core/defmacro let
"binding => binding-form init-expr
Evaluates the exprs in a lexical context in which the symbols in
the binding-forms are bound to their respective init-exprs or parts
therein."
[bindings & body]
(assert-args let
(vector? bindings) "a vector for its binding"
(even? (count bindings)) "an even number of forms in binding vector")
`(let* ~(destructure bindings) ~@body))
clojure-mode.el defines its own specs for core functions: (
Aha!
Calva uses an (aging) fork of cljfmt
. See https://calva.io/formatting/ Not sure it is possible to make it format like that. Also I have seldom seen the let box placed on the next line. The only time I do it is to get the extra four spaces, but emacs would make it save only one. 😃
Yep, maybe let
was a bad choice of example, see defrecord
which has 2 special args:
(defrecord TheNameOfTheRecord
[a pretty long argument list]
SomeType
(assoc [_ x]
(.assoc pretty x 10)))
Dear Calva-friends. Thanks to all of you who mentioned @brandon.ringe and me when asked about people you appreciate in The State of Clojure 2021 survey. Brandon filtered those answers out and showed me. I’ve been having a rough day otherwise (I’m fine, don’t worry), and that list has been a very needed source of joy. It’s quite surprising to me how much I appreciate the recognition. I might as well paste it here. 😃 > 1) @borkdude Michiel Borkent I really like what he’s doing with babashka. It’s opening a whole new area of simple standalone applications which starts blazingly fast. And you can use REPL-driven-development for your scripts. Awesome. It is a great and easy way to introduce clojure to your colleagues! 2) Guys behind Calva (@pez Peter Strömberg, @bpringe Brandon Ringe), because Calva is getting better and better! And many, many others. > > Brandon Ringe for working on Calva. > > Calva & shadow-cljs maintainers for providing awesome tools; Clojurists together for pioneering funding open source projects. > > All the people building Clojure IDEs, especially Calva and Cursive. > > Too many to really say... Obvious names would be the likes of Rich Hickey and Alex Miller. Others would include people like Sean Corfield, Michel Borkent, Bozhidar Batsov, Peter Stromberg and the rest of the folks working on Calva, and others contributing to the plethora of tooling that is coming out lately > > Vlad Protsenko, Sean Corfield and the Calva team. Vlad and the Calva team are helping to create some truly amazing tooling that makes Clojure not just easy and fun to work with, but easier to demonstrate Clojure’s inherent value to my coworkers. And Sean Corfield’s activity and support in the Clojure community helps lift up everyone. > > The Calva & clojure-lsp people, they are very responsive > > thomas heller because shadow is great borkdude because is doing a lot pez for calva! > > Stu(talks,book), Rich(clojure), Alex(book, clojure) Calva dude Sean Corfield (jdbc, slack) Borkdude(babashka) Luminus web dude Pithyless for that datalog video Tonsky for datascript Phil for Leiningen James Reeves for ring stuff > > I appreciate Peter Stromberg for creating Calva for VS Code, Sean Corfield for his helpfulness, Michiel Borkent for his library/tool contributions, and Bozhidar Batsov for all his hard work and contributions. > > Michiel Borkent for his various libraries. Peter Strömberg for his work on Calva. David Nolen and Rich hickey in general. > > Sean Corfield for explaining in a very good way. Peter Strömberg for pushing Calva with every comment to new heights. > > ...And honestly too many other awesome folks doing great work on alternate language implementation like Joker, Ferret, and providing great tooling like clj-refactor, the auto-complete lib used by cider, Calva, and all the people putting out great libraries like datascript, datahike, reagent, duct, ring, aleph, etc. > > From clojurians slack: borkdude, snoe, PEZ, bringe, > > @borkdude - very helpfull @pez - also helpful and for providing Calva @alexmiller - also helpfull I’ve interacted with them when I posted about my troubles. I found the online interaction to be very nice. > > Sean Corfield - for his generous and lucid sharing of expertise Peter Strömberg (“Pez”) - for seemingly tireless work on Calva > > PEZ. Thanks to Calva the barrier of entry has been lowered. It’s a super nice extension for VSCode and I’ve had people with zero functional programming experience getting up to speed with Clojure quickly in a professional environment thanks to it. > > Tools: https://github.com/liquidz for vim-iced https://github.com/bbatsov for nrepl https://github.com/borkdude for clj-kondo https://github.com/weavejester for eftest, hashp, cljfmt https://github.com/PEZ for Calva. Content: https://github.com/ericnormand for newsletter and videos https://github.com/plexus for the advent of code videos https://github.com/BrunoBonacci for London Clojurians > > Too many to count Alex Miller - responsive, respectful and always gives amazing thought-out advice olivergeorge. joshmiller, pez, vikeri...
I shortened a couple to the relevant parts. Love all the mentions of @borkdude and clojure-lsp as well.