Open harold opened 3 weeks ago
Agree, really nice library and talk!
I also noticed the 2 spaces behavior, and it appears to be intentional and based on: https://tonsky.me/blog/clojurefmt/
That makes sense and I can work with that, but would like to know how to get the same indenting in clojure-mode
Thanks for linking that article, @jeisses - I learned a lot.
I will need to look closer at the diffs this produces in our larger code bases before I can decide or say more.
information on how to make clojure-mode behave the tonsky way would be appreciated.
Thank you for the kind words @harold and @jeisses - they are appreciated 🤓
I also noticed the 2 spaces behavior, and it appears to be intentional and based on: https://tonsky.me/blog/clojurefmt/
Standard Clojure Style uses Fixed Indentation by default, unless the user vertically aligns elements using Rule 3. There is a section in the Clojure Style Guide titled "Semantic Indentation vs Fixed Indentation" for understanding the difference and terminology here.
I am a fan of the simplicity of Fixed Indentation for Clojure code and I hope that this library enables Clojure teams to standardize on this and remove the complexity of indent specs and other complex formatting configs.
information on how to make clojure-mode behave the tonsky way would be appreciated.
One of my goals for Standard Clojure Style is to "meet the user where they are", so it is important to me to support Emacs users in an easy / idiomatic way. But I am not a regular Emacs user myself, so I am not sure of the best way to advise this. This might be helpful?
Hi, just watched your conj talk, this is cool - your efforts are appreciated.
I ran it on one of our projects, and it ran quickly, and it's interesting to see what it did to the
ns
forms, we could probably standardize on what it's doing there.It also cutely found a few
(str ... "..." x "...")
type forms that had extra spaces in them. And some;;comment
->;; comment
ones. Which is cool.Most of the real discrepancies had the following flavor though:
In emacs, with
clojure-mode
when I indent this region, I get this:It seems this library would prefer this:
(second line is indented two spaces instead of one).
Here's a real-life one:
Here's the bit of the Clojure Style Guide that calls for the way my editor works: https://github.com/bbatsov/clojure-style-guide?tab=readme-ov-file#function-arguments-indentation
I do not use parinfer (I use smartparens) or editors other than emacs/clojure-mode/cider. Naturally everyone's mileage may vary.
Anyway, thanks again for your cool efforts here. I do think a
gofmt
for Clojure is noble.