Fork me on GitHub
#editors
<
2018-06-16
>
bozhidar11:06:12

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. 🙂

bozhidar11:06:00

> 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”

bozhidar11:06:22

@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.

bozhidar11:06:53

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

bozhidar11:06:44

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).

bozhidar11:06:29

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

bozhidar11:06:45

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

bozhidar11:06:15

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.

bozhidar11:06:53

(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)

pez16:06:00

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

pez16:06:20

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

bozhidar16:06:42

Ops, yeah - cljfmt.

bozhidar16:06:12

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

pez16:06:18

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

pez16:06:38

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.

bozhidar16:06:40

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

bozhidar16:06:16

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

bozhidar16:06:47

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

pez16:06:29

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

bozhidar16:06:57

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

😃 4
bozhidar16:06:17

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

pez16:06:13

Where do I find Cider’s indentation engine?

bozhidar16:06:10

@pez That’s complex. 🙂

bozhidar16:06:04

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

bozhidar16:06:15

(which we hope every editor will support some day)

bozhidar16:06:52

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

bozhidar16:06:30

Those are the highlights of the implementation.

pez17:06:34

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

pez17:06:49

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?

bozhidar20:06:01

No, it doesn’t.

👍 4
bozhidar20:06:34

It can’t prettify code or something like this.

cfleming23:06:10

@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.

cfleming23:06:11

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.