I want to create a variant of `defun' that takes arguments from Emacs and assembles a body to be evaluated by SLIME.
It seemed to me that this macro definition w ould work:
(defmacro ldefun (name arglist &rest body) `(defun ,name ,arglist (slime-eval (progn ,@body))))
For example, here is how it expands in a simple case:
(macroexpand '(ldefun testslime (first second) (list first (+ 1 second))))
;=> (defun testslime (first second) ;=> (slime-eval (progn (list first (+ 1 second)))))
But that didn't turn out.
In fact, even the `slime-eval' form just above does not work in a stand-alone fashion:
(slime-eval (progn (list 2 (+ 1 6))))
Gives this error:
Execution of a form compiled with errors. Form: (2 7)
Whereas from the REPL, I get this behavior:
CL-USER> (progn (list 2 (+ 1 6))) (2 7)
So, I find this behavior surprising. Can anyone help me out?
Note: I'm running Slime CVS from 2007-06-16 and SBCL 1.0.5.