Hi,
Attached are files which I propose to add to contrib/ to allow image display in the repl. The Common Lisp support is entirely non-existent, but I have prototype code using the slime support to do manipulations of graphical objects in R: http://doc.gold.ac.uk/~mas01cr/tmp/swankr-images.png displays an example.
I'd like to put this or something like it in; I'm asking for review of this approach and implementation.
Cheers,
Christophe
On 9/14/10, Christophe Rhodes csr21@cantab.net wrote:
Hi,
Attached are files which I propose to add to contrib/ to allow image display in the repl. The Common Lisp support is entirely non-existent, but I have prototype code using the slime support to do manipulations of graphical objects in R: http://doc.gold.ac.uk/~mas01cr/tmp/swankr-images.png displays an example.
I'd like to put this or something like it in; I'm asking for review of this approach and implementation.
For what it's worth, I've always wanted something like this.
It's possible to even go crazy, and have an analogue to print-object to give an image view of everything. The resulting presentations can give something that feels like Smalltalk. :)
Yong.
* 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.
Helmut
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).
Thanks,
Christophe
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