[slime-cvs] CVS slime/contrib

CVS User crhodes crhodes at common-lisp.net
Thu Sep 16 13:24:20 UTC 2010


Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv24759/contrib

Modified Files:
	ChangeLog 
Added Files:
	slime-media.el swank-media.lisp 
Log Message:
slime-media contrib

Basically, just a hook to be able to display images in the REPL.  No CL-side
functionality for now (but an explanatory comment for the intrepid SLIME/CL
hacker...)


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2010/09/09 08:28:21	1.416
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2010/09/16 13:24:20	1.417
@@ -1,3 +1,10 @@
+2010-09-16  Christophe Rhodes  <csr21 at cantab.net>
+
+	Image display support for the REPL.
+
+	* slime-media.el: New file.
+	* swank-media.lisp: New file.
+
 2010-09-09  Stas Boukarev  <stassats at gmail.com>
 
 	* swank-c-p-c.lisp (longest-compound-prefix): Wrong arguments for

--- /project/slime/cvsroot/slime/contrib/slime-media.el	2010/09/16 13:24:20	NONE
+++ /project/slime/cvsroot/slime/contrib/slime-media.el	2010/09/16 13:24:20	1.1
(define-slime-contrib slime-media
  "Display things other than text in SLIME buffers"
  (:authors "Christophe Rhodes <csr21 at cantab.net>")
  (:license "GPL")
  (:slime-dependencies slime-repl)
  (:swank-dependencies swank-media)
  (:on-load
   (add-hook 'slime-event-hooks 'slime-dispatch-media-event)))

(defun slime-dispatch-media-event (event)
  (destructure-case event
    ((:write-image image string)
     (let ((image (find-image image)))
       (slime-media-insert-image image string))
     t)
    (t nil)))

(defun slime-media-insert-image (image string &optional bol)
  (with-current-buffer (slime-output-buffer)
    (let ((marker (slime-output-target-marker :repl-result)))
      (goto-char marker)
      (slime-propertize-region `(face slime-repl-result-face
                                      rear-nonsticky (face))
        (insert-image image string))
      ;; Move the input-start marker after the REPL result.
      (set-marker marker (point)))
    (slime-repl-show-maximum-output)))

(provide 'slime-media)
--- /project/slime/cvsroot/slime/contrib/swank-media.lisp	2010/09/16 13:24:20	NONE
+++ /project/slime/cvsroot/slime/contrib/swank-media.lisp	2010/09/16 13:24:20	1.1
;;; swank-media.lisp --- insert other media (images)
;;
;; Authors: Christophe Rhodes <csr21 at cantab.net>
;;
;; Licence: GPLv2 or later
;;

(in-package :swank)

;; this file is empty of functionality.  The slime-media contrib
;; allows swank to return messages other than :write-string as repl
;; results; this is used in the R implementation of swank to display R
;; objects with graphical representations (such as trellis objects) as
;; image presentations in the swank repl.  In R, this is done by
;; having a hook function for the preparation of the repl results, in
;; addition to the already-existing hook for sending the repl results
;; (*send-repl-results-function*, used by swank-presentations.lisp).
;; The swank-media.R contrib implementation defines a generic function
;; for use as this hook, along with methods for commonly-encountered
;; graphical R objects.  (This strategy is harder in CL, where methods
;; can only be defined if their specializers already exist; in R's S3
;; object system, methods are ordinary functions with a special naming
;; convention)




More information about the slime-cvs mailing list