On 15 September 2010 22:29, Christophe Rhodes csr21@cantab.net wrote:
Helmut Eller heller@common-lisp.net writes:
- Christophe Rhodes [2010-09-13 21:14] writes:
I'd like to put this or something like it in; I'm asking for review of this approach and implementation.
Emacs side looks good. Lisp side is empty, so I suspect you want to have this in CVS primarily because something breaks as soon you load the R stuff. If that's the case then please add a comment somewhere that it's needed for something else.
Thanks. It's not so much that anything breaks unless the slime-media contrib is requested; it's more for my own convenience, so that I don't go mad simultaneously doing CL, elisp and R development, with different contribs useful in CL and R. The alternative would be not to have the stub CL file at all and not to have the :swank-dependencies swank-media clause -- but I think that essentially any use of this contrib will require some swank adaptation to actually emit the :write-image event.
I'll add a comment making this clear in the .lisp file (including the implementation strategy for making this useful in the R side, in case anyone is motivated to emit images from any other swank backends).
So, I decided I wanted to get images in my Slime REPL with this.
Currently I don't see a way to sanely send a :write-image message, because it is sent as a list and the :type properties to end up as some-package::png, not png on the Emacs side.
eval-in-emacs seems to work around this by sending strings which the Emacs-side then calls read on. Possibly :write-image should do the same, or use an explicit type and file parameter in the message? (And call intern on the type.)
Anyways, I still managed to get pictures in my REPL:
(defun send-image (pathname &optional type) (let ((type (or type (type (intern (string-upcase (pathname-type pathname))))))) (swank::eval-in-emacs `(slime-media-insert-image (find-image '((:type ,type :file ,(native-namestring pathname)))) nil t))))
Cheers,
-- Nikodemus