I've been following a tutorial and hit an error where there wasn't one in the book. I have reinstalled leinigen, updated java and reinstalled cider on emacs.
But doesn't seem to help and I can't find this error message online. Running M-x "cider-jack-in" to open a REPL gives me the error message:
"Symbol’s function definition is void: sesman-current-sessions"
and I can't figure out what's causing this, any help is gratefully received.
I ran into the same problem. It's possible that you're using an old version of the sesman package. Updating cider for me didn't update the sesman dependency.
For example, sesman-20180903.1826 doesn't define sesman-current-sessions while sesman-20181109.1100 does. Updating sesman fixed the issue for me.
Can you post your project.clj file? Maybe it contains old versions of libraries that are either conflicting with the newest CIDER.
A typical minimal project.clj from a fresh new project created with lein new app myapp will look like this:
(defproject myapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.9.0"]]
:main ^:skip-aot overflow.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
Related
Following this guide to configure Spacemacs as a C++ IDE, I am facing an issue when installing Flycheck.
I have followed the instructions explained here but after adding the syntax-checking instruction under dotspacemacs-configuration-layers, I have the following error when lauching spacemacs :
Error (use-package): flycheck/:init: Symbol’s function definition is void: global-flycheck-mode
I am totally new to spacemacs and emacs in general so I might have missed something obvious.
Emacs version : 27.0.50
Spacemacs version : 0.200.13
Thanks for your help,
I add additions package in this function
dotspacemacs-additional-packages '(org-trello ereader plantuml-mode elmine org-alert org-super-agenda easy-hugo ponylang-mode flycheck-pony flycheck-plantuml)
and in the (custom-set-variables add the packege to '(package-selected-packages
After restart spacemacs, all works for me, hope it will be helpful to you too.
I'm currently working through the Midje tutorial:
https://github.com/marick/Midje/wiki/A-tutorial-introduction
I load the repl using cider-jack-in and can successfully run (autotest) which runs the tests.
However, when I change either the source or test files (and save them), the repl doesn't trigger a reload of the files and re-run the tests.
The reload works fine if I run the REPL from the command line.
I'm running Cider 0.8.1 nREPL 0.2.6 Clojure 1.4.0 on Windows 7.
Has anyone else had a problem with getting the REPL in Cider to work correctly with autotest and get it to rerun the tests when the source/test files are changed?
I had the same problem and solved it by updating the midje and lein-midje versions:
.lein/profiles.clj
{
:user {:plugins [[lein-midje "3.2"]]}
:repl {:plugins [
[refactor-nrepl "2.0.0"]
[cider/cider-nrepl "0.10.2"]
]}
}
project.clj:
(defproject cjtest "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.7.0"]]
:profiles {:dev {:dependencies [[midje "1.6.3"]]}})
I've decided I want to use Clojure's Java interoperability to play with the jMusic library. Because I know Java better than Clojure (by a lot), I'm testing things in Java and then rewriting them as (not-so-idiomatic) Clojure. I'm using Eclipse Luna with the Counterclockwise plugin, and am not using Maven, just Leiningen. As a quick aside, I don't want to use Emacs because I want to focus on learning one tool at a time.
To incorporate jMusic, I've downloaded the file and am right-clicking on the Project folder, selecting Build Path, and selecting Add External Archive. I've done that with both the Clojure project and the Java project. I have the following Java code:
import jm.music.data.Note;
import jm.util.Play;
public final class TestMusic {
public static void main(String[] args) {
Play.midi(new Note());
}
}
This program runs and makes noise without issue. I cannot reproduce this in Clojure. I wrote the following code (which could be wrong, but that's a separate issue):
(ns my-clojure-test.core
(:use jm.music.data Note)
(:use jm.util Play))
(. Play midi (. Note))
And I get the following error:
;; Clojure 1.6.0
CompilerException java.io.FileNotFoundException: Could not locate jm/music/data__init.class
or jm/music/data.clj on classpath: , compiling:(my_clojure_test/core.clj:1:1)
#<Namespace my-clojure-test.core>
I've tried doing the same right-click on the project and adding an external archive. I've moved the jMusic.jar to src/java, and also extracted its files alongside the .jar.
My project.clj file looks like this:
(defproject my-clojure-test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.logic "0.8.10"]]
:source-paths ["src" "src/my-clojure-test"]
:java-source-paths ["src/java"])
How do I get Clojure to recognize the jMusic so I can make the aural "hello world" program play?
EDIT:
The selected answer does work, but do check the comments for more details about what I had to do to get it working, in case anyone else runs into the same problem.
To break down the error message:
CompilerException java.io.FileNotFoundException: Could not locate jm/music/data__init.class
or jm/music/data.clj on classpath: , compiling:(my_clojure_test/core.clj:1:1)
#<Namespace my-clojure-test.core>
This is saying that it was looking for either jm/music/data__init.class or jm/music/data.clj. Either one would suffice in order to load the namespace jm.music.data which you have asked for in your ns declaration. Of course there is no such Clojure namespace. This happened because you tried to use use to access classes, and it is designed for accessing namespaces. import is for accessing classes and packages.
(ns my-clojure-test.core
(:import (jm.music.data Note)
(jm.util Play)))
The . notation takes a method first, then the class, except when accessing a static method, in which case one should use /. The proper way to invoke a constructor is with the . following the classname, without any separator.
(Play/midi (Note.))
I'm using leiningen in Eclipse. I can't seem to load the clj-time libraries.
Here's my project.clj:
(defproject MatchAnal "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:keep-non-project-classes true
:dependencies [[org.clojure/clojure "1.5.1"] [clj-time "0.5.1"]])
I clicked on Leiningen -> Update Dependencies in my project and I can see the clj-time-0.5.1.jar in the Leiningen dependencies tree.
When I try to use clj-time from the repl or in a namespace I get a namespace not found excpetion. For example if I type this in the repl:
(use 'clj-time.core)
I get:
Exception namespace 'clj-time.core' not found clojure.core/load-lib (core.clj:5380)
According to the comments, I'm posting the answer here:
Try to remove :keep-non-project-classes and then try lein clean and then lein deps and see whether it is going to work.
I've a problem. I've installed clojure, slime, slime-repl and elein using marmalade. Now I open my project and call elein-swank. I get this:
Starting swank..
error in process filter: slime-presentation-init-keymaps: Symbol's function definition is void: slime-define-both-key-bindings
error in process filter: Symbol's function definition is void: slime-define-both-key-bindings
and If I try clojure-jack-in I get
Debugger entered--Lisp error: (error "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.
signal(error ("Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.\n"))
error("Could not start swank server: %s" "That's not a task. Use \"lein help\" to list all tasks.\n")
clojure-jack-in-sentinel(#<process swank> "exited abnormally with code 1\n")
What can I do?
I'm not sure what elein is, but I think for clojure-jack-in you need to install the swank-clojure plugin:
lein plugin install swank-clojure 1.3.3
update: as of 2013, M-x nrepl-jack-in is preferred
The jack-in method is the preferred one, but you may also try the old favorite: run
$ lein swank
from the project's main dir, and then:
M-X slime-connect
from emacs. You still need swank-clojure:
$ lein plugin install swank-clojure 1.3.3
this happened to me when i cloned someone else's clojure project from an older version. their project.clj had:
:dev-dependencies [[lein-clojars "0.5.0"]
[swank-clojure "1.2.1"]]
which is incorrect, i think, if you're using M-x clojure-jack-in. removing these lines, running lein deps and jacking in worked for me.
If you're using lein 2, then try adding {:user {:plugins [[lein-swank "1.4.4"]] } } to ~/.lein/profiles.clj. see the Plugins section of https://github.com/technomancy/leiningen/wiki/Upgrading and https://github.com/technomancy/swank-clojure