Created
July 19, 2020 15:26
-
-
Save nirved/e59aa01f2cd6d75ca6d5dde08c037519 to your computer and use it in GitHub Desktop.
Displaying svg image in slime-repl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; eval inside emacs: | |
(setq slime-enable-evaluate-in-emacs t) | |
;; in slime-repl: | |
(ql:quickload :cl-svg) | |
(let ((scene (svg:make-svg-toplevel 'svg:svg-1.1-toplevel :height 300 :width 300))) | |
(svg:draw scene (:rect :x 5 :y 5 :height 30 :width 30)) | |
(svg:draw scene (:rect :x 40 :y 40 :height 30 :width 30) | |
:stroke "blue" :stroke-width 1 :fill "yellow") | |
(svg:draw scene (:rect :x 75 :y 75 :height 30 :width 30) | |
:fill "purple") | |
(let ((s (with-output-to-string (s) | |
(svg:stream-out s scene)))) | |
(swank:eval-in-emacs `(slime-media-insert-image (create-image ,s 'svg t) "test")))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment