Issue with Cider

I decided to take the plunge into the clojure world and was setting up my environment as described in braveclojure.com. I was able to get the packages installed, but now I am faced with the issue of evaluating form in my source code. When I press C-x C-e, I get the following message

error in process filter: cider-get-ns-name: Wrong number of arguments: ((clojure-mode-abbrev-table t) nil "Return the namespace of the current Clojure buffer.

Return the namespace closest to point and above it.  If there are
no namespaces above point, return the first one in the buffer.

The results will be cached if `clojure-cache-ns' is set to t." (if (and clojure-cache-ns clojure-cached-ns) clojure-cached-ns (let ((ns (save-excursion (save-restriction (widen) (condition-case nil (progn (while t (up-list nil t t))) (error nil)) (or (clojure--find-ns-in-direction 'backward) (clojure--find-ns-in-direction 'forward)))))) (setq clojure-cached-ns ns) ns))), 1

What’s the form you’re evaluating? Is CIDER jacked in or connected to an nREPL server?

(println "Cleanliness is next to godliness") is what I am evaluating.
Yes, CIDER is jacked-in and connected to an nREPL on localhost.

And the nREPL is running with namespace clojure-noob.core>

One meta-suggestion:

  • Learning both Emacs and Clojure at the same time is a lot
  • If you’re already familiar with a different editor that has a Clojure integration, use that to learn Clojure (then maybe learn Emacs later if you’re still interested in Emacs itself)

Great Clojure integrations exist for VS Code (Calva) and IntelliJ (Cursive). There are also integrations for vim/neovim, if that’s your editor-of-choice.

1 Like

Thank you for your suggestion :slightly_smiling_face:
I fixed the issue by changing the package-archives from "http://melpa.milkbox.net/packages" to "https://melpa.org/elpa".
I think I will give VS Code a shot. Don’t know the interactive development story on that front. It looks like Calva can offer the same features that CIDER does for Emacs. I am going to try it out.

If you do continue with Emacs, I would highly recommend asking questions on the IRC channel for Emacs on Libera Chat (web link: Kiwi IRC). It has got to be the friendlist IRC channel I have ever been on, and I have been surprised by the expertise on non-Emacs topics too. I once mentioned a tricky C++ problem to do with class templates and dynamic arrays, and someone solved it within minutes, where even the C++ chatroom couldn’t help. You will certainly find lots of CIDER experts on it!

1 Like

Be aware that although the Code in BraveClojure is still very relevant, much of the Emacs section of the book is outdated.

I learned Emacs & Clojure at the same time. The main thing to establish is a working REPL workflow and ideally structural editing support (paredit, parinfer, smartparents, etc)

A simpler start with Emacs is to use one of the community configurations available

prelude
Created by the author of CIDER, the defacto tool for Clojure development with Emacs. Uses the Emacs chorded key bindings, e.g . C-x C-s

Spacemacs
Excellent for beginners to Emacs due to very discoverable and consistent mnemonic key bindings (sequential, e.g SPC f f to find files). Very extensive package support, wrapped in layers to make it easy to add major features.
Supports Emacs and vim-style editing

Practicalli Spacemacs provides an extended install and user guides for Emacs with Spacemacs (much of which is relevant to most Emacs configs)

Doom
A focus on optimised startup and essential packages, very effective for those familiar with vim-style modal editing or want to learn how to create their own tailored workflow

Clojure support is very widespread in all the common editors. Although Emacs is still by far the most popular Editor for Clojure, using an editor that is very familiar reduces some learning requirements

Clojure Editors - Practicalli Clojure

1 Like

What is the best resource to learn clojure in 2023?

The best starting place to learn Clojure is Clojure.org, which also has many great links to community content and commercial books

The best resource is that which the individual finds most useful to there learning style and level of experience (this is true of any programming language)

Otherwise there are as many options as there are ways to learn a programming language.

Start with the freely available content first.

It greatly depends on who is doing the learning.