GNU Emacs + Cider vs VS Code + Calva

Hello

I am looking into whether to use GNU Emacs + Cider or VS Code + Calva for Clojure programming. Since I am neutral with regards to GNU Emacs vs VS Code it is unclear to me which editor+extension combination I should use.

Could I get a rundown of what the advantages/disadvantages of Cider and Calva are?

Thanks

2 Likes

Both combos are great. Emacs perhaps leads into more things than VS Code does in the long run, but that could just be me justifying why I’ve been using emacs for the last 24 years.

What have you used in the past and what do you want to do beyond just clojure?

1 Like

VSCode is much friendlier to beginners, uses a UX language that is more modern with more modern shortcuts, and it plays well with Windows.

If you’re someone who generally prefers say MacOS or Windows over Linux. You’ll probably be happier with CSCode and Calva.

Emacs is way more customizable and extensible, and has many features other editors lack. It excels at a keyboard only workflow (no need to use the mouse for anything). You can even easily add your own custom features to it. It’s feature set for Clojure editing is probably unmatched, but I’d say Calva is 90% there, and you probably won’t miss the difference. It can also be run from the command line fully without a UI if that’s something you care about.

If you’re someone who likes to thinker and customize everything. If you like to do things without a mouse. And if in general you prefer Linux over MacOS or Windows, you’ll probably like Emacs + Cider better.

Edit: Just wanted to add, Calva and Cider both use The Orchard as their underlying “backend”. The difference is mainly in their editor integration.

2 Likes

In the past I have used both GNU Emacs and VS Code, but nowadays I primarily use VS Code because for many languages(especially JavaScript!) it has better support for the language and ecosystem.

If you’re already comfortable with Emacs, Emacs+Cider better supports Clojure in my opinion, but Calva is pretty decent at it too, just I’d say not as much as Emacs+Cider is.

1 Like

I am already comfortable with GNU Emacs.

Emacs+Cider better supports Clojure in my opinion

Could you elaborate on where they differ and how you think Cider supports Clojure better?

Thanks

Well, all features come to Cider first, like I said, Calva uses Cider’s underlying backend and integrates it into VSCode.

More specifically, I’ll say Emacs better supports s-expression syntax and manipulation for it. And Cider has a better REPL integration. Calva faces limitations with what it can do in certain places due to the VSCode API, REPL being one of them.

Cider also has just more features, but it’ll be things like Cider inspector, or enlighten mode, or ability to macroexpand, etc. So less commonly relied on I’d say.

Cider has a better test runner too, Calva has some limits around running single tests and things like that.

Honestly, they differentiate mostly in the details, but I’d say try both, it won’t take long.

2 Likes

In addition, Calva has a very nice integrated linter. Calva continues to evolve and the gaps are closing: the recently improved Paredit is an example. Emacs has some systemic strengths, but if you are happy with VS Code so far, they can wait. Someday VS Code or Calva will give you an auto-update that breaks everything, and at that time you can try Emacs. Some time later, you will update Emacs or Cider and break everything, and you will switch back to VS Code.

2 Likes

VSCode is much friendlier to beginners, uses a UX language that is more modern with more modern shortcuts, and it plays well with Windows.

I never liked Emacs’ parallel universe of short cuts. A couple of decades growing up on windows, using C-x, C-c, C-v, C-z, for cut, copy, paste, undo (especially after writing many many papers…). So the first think I do when working with folks coming to Emacs from a windows background is have them turn on CUA-mode, which turns emacs into more-or-less an advanced notepad for them. Then instead of flailing around trying to learn new shortcuts and avoiding the mouse via the “Emacs way” (which is honestly weird), they can immediately apply what they know and get to work (similar to what you get with VSCode or any other typical editing environment). Use familiar keyboard/mouse interactions and emacs feels far less alien. Migrate toward keyboard only if you want/need to later (extremely advantageous when accessing remote machines via terminal).

it is unclear to me which editor

Spacemacs + Clojure layer (includes Cider) + CUA-mode is my go to. I am fascinated by the growth in usability of the VSCode world though; the out-of-box experience is pretty excellent, and probably welcome for beginners. I think the emacs setup will grow with your for the long haul, since you can use emacs seamlessly for everything (e.x. editing org, latex, html, whatever…). Any time I have needed to edit something, I find a spacemacs layer or an emacs package for it. So the “ecosystem” is incredibly robust IMO, even without all the customizations you can apply.

I am unsure about the debugging situation in Calva, but Cider’s debugger integration and inspector are really nice. I tend not to use them a lot, but when I have needed them they were invaluable.

2 Likes

Even as a long time emacs user, on and off for about 30 years, I would always recommend Code + Calva, or perhaps Intellij + Cursive (if you’re used to Intellij. Calva is super friendly and @PEZ is a very responsive maintainer.

The interactive getting started guides are also very nice in Calva.

One tip though, is to spend an afternoon teaching yourself the basics of paredit. barf/slurp, forwards/backwards sexps are such time savers and they reduce all the friction you might have with the parens.

3 Likes

For now I am going with Calva.

spend an afternoon teaching yourself the basics of paredit. barf/slurp, forwards/backwards sexps are such time savers and they reduce all the friction you might have with the parens.

Will do!

2 Likes

I hope you’ll enjoy it and will chose to stay! Please consider joining the calva channel on the Clojurians Slack. It’s a typical Clojure community place, I would say. Full of friendly and helpful people all interested in seeing others succeed.

As for the major thing lacking in Calva, compared to CIDER, I think that is the inspector. Maybe lately that has become a less glaring hole, because of tools like Reveal, Portal, shadow-cljs, and more.

2 Likes

I think the conclusion to take is that the relevant choice is more about Emacs vs VSCode, because in terms of Clojure, both Cider and Calva are pretty similar in their feature set, with Cider having just a little more features but nothing major.

1 Like

I don’t think anyone has mentioned it but emacs is customized and extended in eLisp, and VSCode in JavaScript. I’m starting to see Lisp as my environment, rather than my Linux OS or the browser. I’m thinking of installing the GNU Guix package manager so I can configure Linux in Guile Scheme too. I’m sure working in three different Lisps won’t be confusing :slight_smile:

I sometimes use very slow machines with low memory. VSCode isn’t practical there. Emacs can be used without a GUI, though that’s not very useful for productive ClojureScript development.

2 Likes

I’m starting to see Lisp as my environment

It has begun :slight_smile:

3 Likes

Stop before its too late :smiley:

I was initially drawn to Clojure because it was a Lisp. I wanted to experience code as data. Now I have, why would I ever give that up? :grinning:

1 Like

Calva is written partly in ClojureScript, and there are extensions written entirely like that. Full hot reload and all that. Also, with tools like sci we will see more end user customization using Clojure.

3 Likes

One thing I haven’t seen anybody mention that is a decider for me is that emacs runs fine via ssh X11-forwarding. VSCode, being electron based, does not support this use-case.

(I have a windows desktop, with ubuntu VM’s. I connect to the VM’s with putty and XMing. In this environment emacs feels very close to a native windows desktop app which is lovely.)

4 Likes

I suggest there is a far greater difference in user experience than specific Clojure features.

Although both VS Code and Emacs can be configured to work in a very similar manner, using VSpaceCode and Spacemacs, which even share very similar key bindings (partly because I contributed many of those key bindings to each project)

There are even a lot of cross over between packages.

So as a user there can be just a difference in UI, even then the differences are becoming increasingly few and far between.

I don’t believe any editor is any easier than any other editor for someone with no preconceived idea of how to use an editor. It just needs a good user guide (they are too feature rich to be intuitive)

There is a really wide support for Clojure in many editors and most can be configured to be relatively equivalent in Clojure specific features

https://practical.li/clojure/clojure-editors/

Hope this helps
John

1 Like