Adam Arold
Adam Arold

Reputation: 30528

How to properly configure CIDER's code completion in Emacs?

I've installed CIDER into my bare-bones Emacs and when I am in cider-mode (also in clojure-mode) and I try to use M-TAB to do code completion I get

Not an nREPL dict object: %

where % is an arbitrary function. For example if I try to do code completion for map in this row:

(ma

I see the following in the Messages buffer:

completion--some: Not an nREPL dict object: map

I did a tabula rasa in my Emacs so my init.el looks like this:

(require 'package)

(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
             '("tromey" . "http://tromey.com/elpa/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)

(package-initialize)

(when (not package-archive-contents)
  (package-refresh-contents))

(defvar my-packages
  '(paredit
    clojure-mode
    clojure-mode-extra-font-locking
    cider))

(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

There is one interesting thing I observed. When I do a cider-jack-in I get connected to an nREPL and in the REPL buffer I see the following:

WARNING: CIDER's version (0.13.0-snapshot) does not match cider-nrepl's version (nil). Things will break!

What am I doing wrong? I can't get CIDER's code completion to work. It is not working even with the simple M-TAB option either.

I am using Emacs 24.3.1.

Upvotes: 2

Views: 689

Answers (1)

zabeltech
zabeltech

Reputation: 971

This is exactly the problem:

WARNING: CIDER's version (0.13.0-snapshot) does not match cider-nrepl's version (nil). Things will break!

Cider consists of two parts, there is the emacs package (CIDER), and the clojure part cider-nrepl. The second one beeing a middleware to clojure n(etwork)-repl

Since development of cider is moving fast, both versions must match. (And also you should alsways use the latest version, what you are doing right now :))

You might want to add this to your project.clj oder profiles.clj

:plugins [[cider/cider-nrepl "0.13.0-SNAPSHOT"]]

there is also lots of documentation at https://cider.readthedocs.io/en/latest/ and on the github repo https://github.com/clojure-emacs/cider

Upvotes: 3

Related Questions