[slime-devel] Sending values to the repl

I want to send values to the repl from the Lisp image. (swank::eval-in-emacs '(slime-repl-send-string "(+ 1 1)")) Firstly, is there a simpler way to approach this? Secondly, the problem is that SLIME-DISPATCH-EVENT for an :EMACS-REX event returns the result of (SLIME-RECOMPUTE-MODELINES T), being: [nil 0 0 100000 nil slime-update-all-modelines nil idle] EVAL-IN-EMACS tries to read this and fails horribly throwing up the following error: error while parsing arguments to DESTRUCTURING-BIND: invalid number of elements in (SWANK-IO-PACKAGE::[NIL 0 0 100000 NIL SWANK-IO-PACKAGE::SLIME-UPDATE-ALL-MODELINES NIL SWANK-IO-PACKAGE::IDLE]) to satisfy lambda list (SWANK::VALUE): exactly 1 expected, but 8 found [Condition of type SB-KERNEL::ARG-COUNT-ERROR] As far as I can see, the solution is to have SLIME-REPL-SEND-STRING return T since there doesn't seem to be anything relying on this current behaviour. I've attached a patch in the case that this is indeed a sane solution. -- Daniel White

Daniel White <daniel@whitehouse.id.au> writes:
I want to send values to the repl from the Lisp image.
(swank::eval-in-emacs '(slime-repl-send-string "(+ 1 1)"))
Firstly, is there a simpler way to approach this?
If you want to write stuff as output to the REPL buffer, use (defun repl-stream () (swank::connection.user-output (or swank::*emacs-connection* (swank::default-connection)))) (format (repl-stream) "Foobar~%") If you want to send something as a result (which will turn into a presentation if you use the slime-presentations contrib), use (defun send-as-repl-result (&rest objects) (funcall *send-repl-results-function* objects)) -T.
participants (2)
-
Daniel White
-
Tobias C. Rittweiler