How I can eval a buffer and/or an instruction within Emacs with Swank and SLIME?
Asked Answered
E

2

8

I've successfully installed clojure-mode, slime, slime-repl within Emacs. I start a swank server with "lein swank" and hang slime to it with "slime-connect". I can use the SLIME REPL to evaluating Clojure expression within the REPL.

How can I eval a single s-exp or a whole file (a.k.a I want to run a Clojure file withing Emacs and see the output in a dedicated frame or in the repl) showing the answer in the SLIME REPL?

For example I define a simple binding in a .clj file within my project directory:

(def my-bind [1 2 3])

Now I want SLIME to eval this expression in the repl, so if in the repl I write:

(first my-bind)

I want to obtain 1. How can I do?

Emmanuel answered 18/10, 2010 at 17:6 Comment(0)
I
9

To eval a single sexp, put your cursor in front of the last closing paren and hit C-x C-e. There is another one to evaluate a surrounding sexp, but I can't for the life of me remember it.

To evaluate the whole file, do C-c C-k

Interlude answered 18/10, 2010 at 17:17 Comment(1)
This is the black magic of computers.. I've done what you have suggested like 1000 times and it never worked.. now it works o.O thank you very much :)Emmanuel
O
9

What Rayne said, and there's M-C-x to evaluate the top level expression which the cursor is in.

Olodort answered 18/10, 2010 at 21:11 Comment(2)
That's the one I was looking for.Interlude
Thanks to everyone, Emacs is freaking awesome :DEmmanuel

© 2022 - 2024 — McMap. All rights reserved.