Cider Stacktrace "No Source Location"

Hello all,

I’m a Clojure noob making my way through “Clojure for the Brave and True”, and started out using the emacs / leiningen / cider configuration as found in that book, on Windows. It used an earlier cider version which I have upgraded to the latest stable version 0.15.1.

Since the upgrade, the stack traces no longer allow jumping to the clojure or java source code, any attempt to select the source code returns either the error “Searching for program: no such file or directory, unzip” or “No source location”.

This is hardly a critical matter at my meager level of Clojure learning, but it’s bugging the hell out of me. It was working before I fooled about with it (I think it was cider 0.8.0 originally. I’ve looked into all sorts of things like java classpaths, leiningen reinstallation etc, but to no avail. I’d love to understand what is / isn’t going on with the tooling.

Has anyone any experience in this matter, or can point me in the right direction?

(It seems to have something to do with cider–jump-to-location-from-info)

You’re totally right to be bugged by this. This is critical functionality to a smooth Clojure workflow!

What’s in your Lein profile? (at ~/.lein/profiles.clj) I ask because the install process for old versions of CIDER required a lot of extra stuff there, which new versions do not, and I wonder if something could cause a conflict.

Also consider posting either a GitHub issue or on the cider channel on Clojurians, which seems fairly active with the maintainers.

Thanks very much for the reply Dave,

My Lein profile is just

{:user {
:java-cmd “C:\Program Files\Java\jdk1.8.0_152\bin\java.exe”
}}

I had a reference to the nrepl version, but removed it as CIDER was complaining. I have tried removing this line, but that didn’t help.

I suspect this is some sort of dumb noob type problem, just wish I knew exactly what sort of dumb noob problem :slightly_smiling_face:

One error is understandable

Searching for program: no such file or directory, unzip

The artifacts in java are (as I understand it, not super well versed in jvm) zip files called jars. Cider is trying to look into them for the source but is denied since it can’t use a program called “unzip”. If this worked in the 0.8.2 days I can’t fathom why. The “no source location” most likely occurs because those functions are defined in the repl. I also think that some of the meta information only gets set under certain conditions with defn forms.

As an aside, I hate that the intro repo for emacs in Brave Clojure is a CIDER version from 2014 and includes byte compiled elc files. I think this is a black mark on an otherwise fantastic resource (I’ve purchased the book and read it online myself).

One way to rectify this is to make unzip visible to emacs. There are several ways to do this but the easiest is modifying the exec-path in emacs. I always run into issues with the path separator on windows. I think the unix style / will work otherwise you have to use \\ since a single slash is an escape modifier.

;; emacs lisp code, not clojure
(setq exec-path (append exec-path '("path/to/unzip")))
;; or
(add-to-list 'exec-path "path/to/unzip")

For information, you can run M-x describe-variable [ret] exec-path and this should open up a buffer telling you the current value and what it is.

Documentation:
List of directories to search programs to run in subprocesses.
Each element is a string (directory name) or nil (try default directory).

This should hopefully remove one obstacle in your path. If you have any questions, drop by cider on slack for immediate feedback.

Thanks very much for the detailed information, that’s given me something to go on.

I’m starting to wonder whether I am just imagining that code source jumping used to work, maybe saw it on a demo rather than on my own setup :disappointed: