[slime-devel] Swank documentation

Harald Hanche-Olsen hanche at math.ntnu.no
Mon May 1 14:53:52 UTC 2006


+ Harald Hanche-Olsen <hanche at math.ntnu.no>:

| I asked the same sort of question of the list back in February:
| 
|   http://common-lisp.net/pipermail/slime-devel/2006-February/004608.html
|   http://common-lisp.net/pipermail/slime-devel/2006-February/004609.html
|   http://common-lisp.net/pipermail/slime-devel/2006-February/004610.html
| 
| Maybe that helps.

I might add that you need to be careful with swank::eval-in-emacs.

It's OK if it causes an emacs error, e.g.,
(swank::eval-in-emacs '(barf)) produces the emacs message "Error in
process filter" and in the slime-repl buffer you'll get
; Evaluation aborted.
But if evaluation of the form in emacs returns a value that the Lisp
reader cannot handle, that's a protocol error, and slime loses the
connection to the backend lisp.

For example, the following naive function does not work, because it
will return a buffer, which prints as #<buffer name>, and that does
not fly with the Lisp reader.  So the correct version needs to arrange
for the emacs form to return something else, like the filename or t.

(defun edit (file)
  (swank::eval-in-emacs
   `(find-file-other-window ,(namestring file))))

(This should use some functions meant to translate filenames between
the slime view and the backend Lisp view, but I haven't gotten around
to learning about those yet.)

- Harald



More information about the slime-devel mailing list