Skip to content

Instantly share code, notes, and snippets.

@digash
Created February 14, 2010 18:36
Show Gist options
  • Select an option

  • Save digash/304171 to your computer and use it in GitHub Desktop.

Select an option

Save digash/304171 to your computer and use it in GitHub Desktop.
(defun slime-repl-emit-result (string &optional bol)
;; insert STRING and mark it as evaluation result
(with-current-buffer (slime-output-buffer)
(save-excursion
(slime-save-marker slime-output-start
(slime-save-marker slime-output-end
(goto-char slime-repl-input-start-mark)
(when (and bol (not (bolp))) (insert-before-markers "\n"))
(slime-propertize-region `(face slime-repl-result-face
rear-nonsticky (face))
(insert-before-markers string))))
(when (search "#<JFreeChart" string)
(let* ((temp-name (make-temp-name (concat temporary-file-directory "incanter-chart-")))
(save-command (format "(incanter.core/save *1 %S :width 400 :height 300)" temp-name)))
(slime-eval-async `(swank:eval-and-grab-output ,save-command)
`(lambda (result)
(beginning-of-line)
(insert-image-file ,temp-name)
(forward-char)
(newline)
(end-of-line))))))
(slime-repl-show-maximum-output)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment