Some thoughts from an old-time Lisper who sometimes gets frustrated by what he sees as people ignoring established Lisp-y practice…
These are important for me:
I think the above things would be massively useful, and I believe, or at least hope, that most people would be happy with them.
Compared to other Lisps, there’s one thing that often causes me problems: the indentation of
cond forms, etc, where the syntax involves pairs of things that are not bracketed. When the second item of a pair starts on a newline, I’d like a little extra indentation (probably two spaces). IMO that would be a significant improvement on what I’m used to, and I hope it would be something most people would be happy with.
For any rules beyond that, there are probably always going to be times I would want to break them.
I do think it would be useful to have options for some things, especially when working on projects where there may be a lack of understanding of or consensus on good style.
I wonder if it would be possible to have options that could be chosen independently, but to also have a set of defined formatting “levels” that progressively define stricter and more contentious sets of options. Then people could choose different levels depending on the needs of different projects. I’d like to be able to say “we’ll go for level-N formatting” for this project rather than fighting over lots of options. There would probably be a big fight over how many levels to have and what goes into what level, but that would be a big fight done just once when designing this new formatter rather than a big fight for every new Clojure adopter or project.
Removed mention of line breaks, because it’s more general than that. I think by default whitespace shouldn’t be changed except to change indentation and, perhaps, to remove trailing whitespace and empty lines at the end of a file. That’s because I think it’s sometimes good to use whitespace in non-standard ways to improve readability. There could be options to do further things with whitespace.