Created
February 14, 2010 18:36
-
-
Save digash/304171 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| (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