[slime-devel] Re: Evaluate forms from within Lisp buffers and displaying the result in the REPL

Madhu enometh at meer.net
Wed Apr 25 04:19:11 UTC 2007


* Rainer Joswig <joswig-F04898.17115523042007 at news.gmane.org> :
| * If I send a defun, after executing it, the cursor is not moved to
| the new prompt at the end of the listener buffer.
| * if the cursor is on the end of a line behind a form and there is a
| form on the next line, the next form will be taken.
| * after execution the cursor in the listener is not moved to the
| prompt.
| * it does not take into account that the Lisp editor buffer package
| could be different from the Listener.

IIRC it used to be possible to easily evaluate the current sexp in a
lisp buffer, in the "current" SLIME REPL, using the correct package
and read-table package of the current lisp buffer, while including
both the evaluated form and output in the SLIME REPL buffer: Sketch:

 (let ((form (slime-defun-at-point))
      (buffer-name (buffer-name (current-buffer)))
      (package-name (slime-find-buffer-package)))
   (with-current-buffer (slime-output-buffer)
     (slime-with-output-end-mark
       (unless (bolp) (insert "\n"))
       (insert ";;;; Evaluating form from buffer " buffer-name " in package "
               package-name ".\n" form "\n;;;; Results: \n")
       (slime-repl-eval-string form)
       (insert ";;;; Done.\n"))))

However, at present this will not work. I think because of swank
protocol changes involving :repl-result, which I believe were
introduced to support presentations.  At present it is not clear (to
me) what the protocol is for moving the point and inserting the prompt
in the SLIME REPL.

There is also, I believe, at present, a bug in that protocol: Any
input entered (at the keyboard by the user) in the SLIME REPL buffer
when slime is evaluating a form, is wiped out when slime finishes
evaluating the form and prinpts the prompt.  This can be irritating at
times.

Resolving these issues would be the first step towards interacting
with multiple SLIME REPLs.

Regarding queueing forms, I wanted to note that with a non SPAWN
communication style, at present, remote evaluations do get queued per
connection. For example, in CMUCL started inside a terminal, Sketch:

* (mp:make-process (lambda () (swank:setup-server 4005 ...) :name "Swank4005))
* (mp:make-process (lambda () (swank:setup-server 4006 ...) :name "Swank4006))

and then using `slime-connect' to open two connections lets me queue
forms for evaluation on each individual connection.

This is far from robust, but could be made so.  Note, at present
support for this is not inside slime (via communication style), but on
top of it, and slime would need rework to support it directly.
--
Madhu




More information about the slime-devel mailing list