Discussion about all editors used for Clojure/ClojureScript
bozhidar 2018-06-16T11:15:12.000036Z

On the subject of the style guide - PRs and issues are always welcome. It’s really hard to get a consensus on some points, so in the end there’s bound to be someone unhappy with certain decisions that were made. 🙂

bozhidar 2018-06-16T11:16:00.000009Z

> I tend to argue these things a lot, because it’s often the case that what people think of as “what lisp needs to do” often boils down to “that’s what emacs does, and it’s hard to change”

bozhidar 2018-06-16T11:17:22.000063Z

@cfleming I don’t believe this is a completely fair assessment of the situation, though. Nothing’s really hard to change, there’s simply no one to change it. I’m working on half the tooling projects for Clojure + all the Emacs stuff (for free) and there’s a hard limit to what I can do.

bozhidar 2018-06-16T11:17:53.000048Z

I get your perspective, but I also get very annoyed that many people just complain about the current situation and do nothing to help…

bozhidar 2018-06-16T11:19:44.000024Z

Lisp history and personal preferences aside I’m open to making whatever changes are needed for better cross-editor collaboration, but I simply don’t have time for all of this and have to focus on the most important things (e.g. rolling out the new nREPL to everyone, etc).

bozhidar 2018-06-16T11:20:29.000037Z

So it’s hard to change is more of a “it’s hard to find the time to change this”.

bozhidar 2018-06-16T11:21:45.000029Z

Btw, just released Orchard 0.3 - the only important change is the var info functionality from cider-nrepl was extracted to orchard.

bozhidar 2018-06-16T11:27:15.000050Z

And yeah - formatting is hard. Having worked a lot on Ruby and Clojure formatters I really hate dealing with this at this point. 😄 Btw, what is clj-format? I’m normally using cljformat and it seems to handle the 1-space indentation just fine.

bozhidar 2018-06-16T11:28:53.000007Z

(and that’s btw a good example of something non-standard in Emacs (every other lisp mode uses 1-space indent and that has been historically the norm for Elisp, Common Lisp, Scheme and Racket) we made configurable just in the spirit of collaboration with others)

pez 2018-06-16T16:06:00.000066Z

I think clj-format might refer to cljfmt which Calva Formatter is using.

pez 2018-06-16T16:21:20.000113Z

What do you mean by cljformat seems to handle 1-space indentations just fine, @bozhidar? Is cljformat the same as cljfmt?

bozhidar 2018-06-16T16:21:42.000061Z

Ops, yeah - cljfmt.

pez 2018-06-16T16:22:00.000026Z


bozhidar 2018-06-16T16:22:12.000072Z

Well, I use this in most of my projects and it doesn’t break the indentation, so I guess it handles this case fine.

pez 2018-06-16T16:25:18.000045Z

I am trying to see how Cider handles it. It seems to be using cljfmt defaults by default. Is that right? I am looking here: https://github.com/clojure-emacs/cider-nrepl/blob/b479d674e3261a9c067d163325bd2689eb8f7dc4/src/cider/nrepl/middleware/format.clj

pez 2018-06-16T16:32:38.000093Z

The reason I want to know is to try make Calva Formatter format the same way as Cider does, by default. So that teams where both vscode and emacs is used should by default have the code formatted in the same way.

bozhidar 2018-06-16T16:32:40.000116Z

Yeah, although CIDER also has it’s own indentation engine, which you’d be using normally

bozhidar 2018-06-16T16:33:16.000148Z

The idea is that you can alternative rebind the indentation stuff to use cljfmt if you work in some cross-tool environment.

pez 2018-06-16T16:33:26.000057Z

I see.

bozhidar 2018-06-16T16:33:47.000059Z

I don’t really use cljfmt from CIDER, I just add it to the CI of my projects and fail the build on inconsistencies.

pez 2018-06-16T16:34:29.000120Z

That sounds like it means that the indentation engine takes similar decisions as cljfmt does?

bozhidar 2018-06-16T16:34:57.000098Z

Yes. That’s what I meant by - “seems it’s compatible with Emacs”. 🙂

bozhidar 2018-06-16T16:35:17.000126Z

I think its author is an Emacs user, based on some presentations I’ve seen by him.

pez 2018-06-16T16:35:41.000008Z


pez 2018-06-16T16:36:13.000049Z

Where do I find Cider’s indentation engine?

bozhidar 2018-06-16T16:42:10.000148Z

@pez That’s complex. 🙂

bozhidar 2018-06-16T16:43:04.000107Z

You can see the section on “dynamic indentation” in cider-mode.el, but it’s not just this. CIDER just builds indentation rules for clojure-mode.el using this specification https://github.com/clojure-emacs/cider/blob/master/doc/indent_spec.md

bozhidar 2018-06-16T16:43:15.000128Z

(which we hope every editor will support some day)

bozhidar 2018-06-16T16:43:52.000098Z

clojure-mode.el’s indentation is partially derived from lisp-mode.el, so the implementation is not self-contained.

bozhidar 2018-06-16T16:45:30.000028Z

Those are the highlights of the implementation.

pez 2018-06-16T17:22:34.000095Z

Thanks! Code formatting really is more complex than one thinks even after having pondering it some time. :face_with_cowboy_hat:

pez 2018-06-16T17:25:49.000040Z

One more question. This indentation engine. Does it do more than just indentation? I mean, does it reformat the code in other ways, than choosing the indentation for each line?

bozhidar 2018-06-16T20:18:01.000097Z

No, it doesn’t.

bozhidar 2018-06-16T20:18:34.000015Z

It can’t prettify code or something like this.

cfleming 2018-06-16T23:44:10.000048Z

@bozhidar Sure, I understand, and I understand that some stuff is just hard to change because it comes from the underlying lisp mode or whatever.

cfleming 2018-06-16T23:45:11.000028Z

But I do think it’s important to distinguish what is the way it is because it’s good to have it that way, and what’s that way just because of historical accident, or because it’s hard to fix or whatever.