Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How use repl with emacs and leiningen

I'm beginning my learning in clojure and a hard part of this has been work with libraries and dependencies...I've worked with javascript and ruby and they have rubygems and npm..really simple...now I'm trying use leiningen..I've installed this, I use emacs and install elein too...I can create a project, handle the libraries and dependencies and work fine..but I can't use the repl and my slime "evaluate expression and evaluate region" don't work...I'm really newbie with slime and clojure mode..and more newbie with leiningen and I don't know how is the workflow...

I set my libraries inside project, my main namespace and invoke "elein-deps" or "elein-install"

I wrote my code and run it using "elein-run"...it run fine

but how can I use the repl..are there a automated way for load the leiningen repl or do I need import my files and namespace inside my repl (sorry but I'm newbie with clojure and I'm not used to the way load files and namespaces with it...I must use "load-file" and the full path to my file...or must I use "use"??)

please if can explain me how is the workflow with leiningen inside clojure I would appreciate it..many thanks!!

like image 675
corb Avatar asked Nov 05 '22 19:11

corb


1 Answers

You need to use 'require' or 'use' to load your code into environment. Leiningen has support for evaluation of code during REPL initialization, the file with code is specified using ':repl-init-script' option. This file will also evaluated during swank's load...

P.S. you can also look onto ':repl-init' option - it will load given namespace and switch to it...

P.P.S. you can also use M-x clojure-jack-in from fresh clojure mode, to bootstrap swank, run 'lein swank' & connect to swank's REPL

like image 162
Alex Ott Avatar answered Nov 09 '22 10:11

Alex Ott