How to set clojure classpath in Emacs after elpa installation?
I am using elpa to add paths to my classpath in clojure repl set in Emacs Obviously, this is not the $classpath environment variable, but the swing clojure classpath variable set by swing Because I use elpa to install swan, clojure, etc., there are a lot of El files can handle everything, not mine Emacs file Unfortunately, I don't know how to change the classpath right now
I tried in my Before and after elpa in Emacs (setq's swing clojure extra Classpaths (list...)), I have tried to add the path directly to the swing clojure classpath emacs,. emacs. d / init. El and emacs. d / user / user. El, but it has no effect
The last thing I have to do is add the current directory "." And I save my clojure program directory I assume that swing clojure classpath is what I need to set Thanks for your help.
Solution
As MAC said, you can use
M-x swank-clojure-project
Establish a soil repl to clojure project; This command will ask your project root directory and will establish a classpath containing various directories, including Src / lib / and resources / (if any)
Alternatively, if you use leiningen, you can start it in the terminal using the command
$lein swank
From your project root directory This will establish a standard project classpath (as above) From here, you can connect to the running process through the Emacs command
M-x slime-connect
Finally, the third option I suggest is to connect to the process started by your own shell script through Emacs / slice (with M-X slice connect), which specifies a set of custom JVM command-line parameters
#!/bin/bash java -server -cp "./lib/*":./src clojure.main -e "(do (require 'swank.swank) (swank.swank/start-repl))"
This allows you to explicitly control how the VM starts, and may be similar to what you might need to do in production