~/bin
, we'll start up the Swank server that runs the Clojure code, start up emacs, and execute some code. Here's how.In your terminal, do the following three:
cd ~/bin/incanter
bin/swank
emacs
Now in emacs, do the following two to play with the ants demo:
C-x C-f path/to/ants.clj
M-x slime-connect
Accept default
Host: 127.0.0.1
with a return-key press; same for port. Now the REPL is running within emacs. Go back to the buffer with the ants.clj
file open and page down to the very bottom.To compile the file, do
C-c C-k
.To interactively execute code, go to the end of the line of code you want to execute from ants.clj, say the line
(send-off animator animation)
then do C-c C-e
Not hard at all!
(Edit 2010-04-09: Weird!
C-c C-e
to execute the last sexp
didn't work for a while here. Had to kill the file buffer and reopen the file. Now it works! Odd.Oh I see, using Clojure Mode, a quick
M-x clojure-enable-slime-on-existing-buffers
solved the problem. Although the keybindings changed somewhat. C-x C-e
to get the above behaviour, while C-c C-e
lets you type in a quick one-line to execute.)
No comments:
Post a Comment