summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorMichael W <gcr@sneakygcr.net>2012-08-12 12:32:03 -0600
committerMichael W <gcr@sneakygcr.net>2012-08-12 12:32:03 -0600
commit998e709f65a8bd9acfd1917d0ac4aaa47f67030b (patch)
tree5bc68e8fffb4a5aea1e9e206d768a505e4b0f279 /elisp
parent540293601e7dcac9eb193d529d7b2413765f3c72 (diff)
downloadgeiser-chez-998e709f65a8bd9acfd1917d0ac4aaa47f67030b.tar.gz
geiser-chez-998e709f65a8bd9acfd1917d0ac4aaa47f67030b.tar.bz2
[WIP] Draw images inline in the Racket REPL.
On the racket side, we use a custom print handler to print images (convertible? values; see file/convertible) in a special format: #<Image: filename> On the geiser side, we add a comint post-output hook to search for that filename and replace it with inline images.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-repl.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 14d71cc..05d4775 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -266,8 +266,19 @@ module command as a string")
(geiser-repl--host)
(geiser-repl--port)))))
+(defun geiser-repl--replace-images ()
+ "Replace all image patterns with actual images"
+ (with-silent-modifications
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "#<Image: \\([-+./_0-9a-zA-Z]+\\)>" nil t)
+ (let ((file (match-string 1)))
+ (replace-match "")
+ (insert-image (create-image file) "[image]"))))))
+
(defun geiser-repl--output-filter (txt)
(geiser-con--connection-update-debugging geiser-repl--connection txt)
+ (geiser-repl--replace-images)
(when (string-match-p (geiser-con--connection-prompt geiser-repl--connection)
txt)
(geiser-autodoc--disinhibit-autodoc)))