4
M-x (cider-jack-in)

cider-jack-in: Symbol's function definition is void: clojure-project-dir

lein run  

"Hello World!"

cat ~/.lein/profiles.clj  

{:user {:plugins [[cider/cider-nrepl "0.14.0"]]}}

clojure-mode is installed. I forked and used Brave Clojure's .emacs.d as the starting point. I am not familiar enough with emacs to know what makes his .emacs.d configuration different. I went through his install and upgrade procedures which I quote from the link above:

WARNING

This project uses an outdated version of CIDER, the package that provides much of the functionality for Clojure development. If you run into issues, try upgrading (instructions below).

Why not just update this package to use the latest CIDER, you ask? This project uses CIDER 0.8.1 so that Clojure for the Brave and True readers are less likely to get confused as they use Emacs for the first time.

Installing

  1. Close Emacs.
  2. Delete ~/.emacs or ~/.emacs.d if they exist. (Windows users, your emacs files will probably live in C:\Users\your_user_name\AppData\Roaming\. So, for example, you would delete C:\Users\jason\AppData\Roaming\.emacs.d.) This is where Emacs looks for configuration files, and deleting these files and directories will ensure that you start with a clean slate.
  3. Download the Emacs configuration zip file and unzip it. Its contents should be a folder, emacs-for-clojure-book1. Run mv path/to/emacs-for-clojure-book1 ~/.emacs.d.
  4. Create the file ~/.lein/profiles.clj (Windows users, this is probably C:\Users\your_user_name\.lein\profiles.clj) and add this line to it:

    {:user {:plugins [[cider/cider-nrepl "0.8.1"]]}} 
    

Then open Emacs.

Upgrading

Before upgrading, ensure that your .emacs.d directory is under version control so that you can always revert to a known good state.

To upgrade:

  1. Edit .emacs.d/init.el, adding these lines after line 12:

    (add-to-list 'package-archives
        '("melpa-stable" . "http://stable.melpa.org/packages/") t
    (add-to-list 'package-pinned-packages '(cider . "melpa-stable") t)
    
  2. Close Emacs.

  3. Run rm -Rf .emacs.d/elpa/cider-*
  4. Open Emacs. You'll probably see some errors and your theme won't load. That's ok.
  5. In Emacs, run M-x package-refresh contents.
  6. In Emacs, run M-x package-install cider.
  7. Close and re-open Emacs.
  8. Open .lein/profiles.clj and remove [cider/cider-nrepl "0.8.1"] from it.

That should install the latest version. Enjoy!

1
  • Please give more details about when you get the error you mention in the title. Also, please summarize what the link to Brave Clojure's says, so that the question makes sense without reading that link (which may turn invalid or very different in the future and would render the question worthless).
    – Stefan
    Commented Mar 10, 2017 at 10:42

7 Answers 7

8

In my case it was using a few old packages. The easiest way was to just upgrade all the packages. I was using the default download from the book Clojure for the Brave and True. Steps (within Emacs):

  • M-x list-packages will list all packages
  • U will mark all packages to be updated
  • x will perform all the updates. You need to confirm the prompt with y that you want those packages updated.
5

For anyone who is still stumbling onto this error, I just managed to fix mine. The problem arises when trying to update the packages that are found in the emacs configuration for the Clojure for the Brave and True book. My guess is that something in the customization files makes emacs compile the packages wrong.

What I did:

  1. First of all, the config file in customizations/setup-clojure.el located in your .emacs directory contains a deprecated function call to cider-turn-on-eldoc-mode according to this post by Bozhidar Batsov. Simply change out cider-turn-on-eldoc-mode to just eldoc-mode within the hook.

2016-04-16 Bozhidar Batsov This was deprecated a while back (and deleted recently). Use eldoc-mode instead in your hooks.

  1. According to this issue on Github about a different, yet similar, problem with Cider, a user suggests deleting all .elc files. These files are the compiled files of your packages. EDIT: I've managed to narrow it down to one specific package. The .elc files within elpa/seq-2.20/ are what's causing the error. Removing the .elc files within should solve the problem.

(for anyone curious to investigate further, the seq-2.20 is the culprit but only when part of this specific emacs setup. It could be a problem between seq and ido-ubiquitous, or one of the other packages in use.)

  1. As Chip mentioned, it is no longer necessary to keep a profiles.clj with you cider version within your .leinfolder. If you have this you can simply remove it.

Hope this helps someone!

1
  • 1
    I also had to upgrade the package clojure-mode. M-x package-reinstall<enter>clojure-mode to get rid of the 'Symbol's function definition is void: clojure-project-dir' upon all cider actions
    – acidjunk
    Commented Apr 5, 2018 at 20:31
1

Working with old .emacs.d stuff is too tiring. I've started working with Prelude. It is developed by the maintainer of CIDER and clojure-mode.

1
  • That doesn't work out either. Even though (cider) is installed, now M-x cider-jack-in results in [No match]
    – Chip
    Commented Mar 11, 2017 at 0:12
0

For the unwashed (and those who haven't touched it in 25 years), emacs is a world unto itself. Configurations are tantamount to new products for those unsure how to navigate the customizations. Hell, every blesses line of emacs is a customization. Power tools can hurt you.

With that, my answer is 2-fold:

  1. As with most software, if you're just starting and going to use a customization, make sure it ain't too old and the developer did a good job. Prelude, for example, has turned out to be a good experience once I got a vanilla emacs install.

  2. I wouldn't use Homebrew's services facility or cask system for emacs. I love Homebrew — and this has been a rare stone in the shoe. Stick with brew install emacs. Plain vanilla. Maybe others are smart enough to get the mac-centric https://emacsformacosx.com to work. I can't linger longer trying.

May our unwashedness pass quickly.

0

I had the same issue with closure-mode installed. All I did is I upgraded cider to the latest version (0.18.0). To fix this I just removed the entire ~/.emacs.d, unziped it from the book again and put {:user {:plugins [[cider/cider-nrepl "0.8.1"]]}} to ~/.lein/profiles.clj

The main drawback is that I use the outdated 0.8.1, but I will wait for the nrepl-0.18.0 release and see if the error can be reproduced with matching versions of cider and cider-nrepl.

0

georger's answer applied in context; I am reading Clojure for the Brave and True. http://nostarch.com/clojure/

OS: Debian GNU/Linux buster/sid x86_64

Kernel: 4.19.0-2-amd64

[install]

sudo apt install leiningen emacs

[sterilize]

cd ~;rm -Rf .emacs.d
wget https://github.com/flyingmachine/emacs-for-clojure/archive/book1.zip
unzip book1.zip
mv emacs-for-clojure-book1 .emacs.d

[begin]

emacs

[upgrade]

M-x list-packages

U

x

...(answer 'y' to upgrade all packages)

[exit] emacs when the upgrade is finished

[restart] emacs,

M-x cider-jack-in
0

If anyone stumbles across the same issue, I found I had to update my installation of sesman as well:

  1. Close Emacs
  2. Run rm -Rf .emacs.d/elpa/sesman-*
  3. Open Emacs
  4. In Emacs, run M-x package-refresh contents.
  5. In Emacs, run M-x package-install sesman.
  6. Close and re-open Emacs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.