tags:

views:

181

answers:

2

Hi,

I'm a starter with Emacs (but quite experienced Vim user) and trying to play with Emacs+Clojure combination. Maybe my setup will be unusual for Emacs world, as I'm not using SLIME/swank-clojure, but Emacs + eshell with running clojure REPL in it, mostly due simplicity (or probably because SLIME quite scares me off :D).

So, maybe there is a Emacs guru that can help me here: does exists any shortcut (or maybe some elisp sample) to copy/paste code chunks (sexps) from editing buffer to eshell (and possibly execute it)?

Thanks.

+1  A: 

Two commands of interest are kill-sexp (normally bound to C-M-k) and mark-sexp (C-M-@). The latter puts mark where point would go with forward-sexp and can be followed by kill-ring-save (M-w) which saves the region to the kill ring without removing it from the buffer. After killing, yank at your convenience.

Note that SLIME is quite an excellent working environment... You really should give it a try someday. :-)

Michał Marczyk
+2  A: 

I think, that you could use standard inferior-lisp command, specifying proper clojure startup command in inferior-lisp-program variable

Alex Ott
Could you please specify what commands one needs to key in? I am not able to comprehend the above answer...Obviously, vim user here. :)
Bart J
@Bart: You can specify the command used by inferior-lisp by running it with a prefix, i.e. "^U M-x run-lisp". I use "~/lein repl", but of course you can specify whatever shell file will run Clojure for you.
brool
you need to put in your emacs file following code(setq inferior-lisp-program "java -jar PATH_TO_CLOJURE_JAR")after this you could run inferior-lisp command directly, and evaluate clojure code directly from buffer with C-x C-e (eval last expression), etc. - see description of inferior-lisp-mode
Alex Ott