Issue with Cider

I decided to take the plunge into the clojure world and was setting up my environment as described in 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 "" to "".
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

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

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)

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

The quick answer is remove the elpa folder in .emacs.d. start emacs, it will reinstall the packages. and cider will work fine.

the long amswer is emacs 29.1 has many breaking changes. the packages that the braveclojure download ships with, do not update properly from emacs 29.1. especially there is a lot of issue with repl. if we remove the elpa folder. then it installs the new versions of all the packages, and tey update properly in sync. i spent a night. was about to delete the braveclojure config i downloaded. meanwhile i installed spacemacs. but there is so much i dont dont understand. so i removed it. i chanced upon the suggestion to remove elpa. btw for future refrence. whenevr we update emacs. it is better to remove the elpa folder and let all the packages reinstall. from the config files.

1 Like

I had the same problem. I didn’t find a direct solution, but I found another way forward that is maybe 80% as good.

First, in your terminal, can you run “lein repl” and get the repl?

If yes, then this works pretty well:

In Emacs, you can open a shell buffer. The command is simply shell. In the shell buffer, cd till you are in the top directory of your project. There you can run lein repl . This will allow you to work in a repl in Clojure.

For me, this has been good enough. It doesn’t have all the bells and whistles of Cider, but it is enough to do a lot of good “repl oriented development” while working in Clojure.