diff options
author | Michael W <gcr@sneakygcr.net> | 2012-08-12 12:32:03 -0600 |
---|---|---|
committer | Michael W <gcr@sneakygcr.net> | 2012-08-12 12:32:03 -0600 |
commit | c08d3d8fd11c8713f0d418431b5c8595667879a0 (patch) | |
tree | f55893746ca5dffb52c7fcabbb06bb44ba873e5c /elisp | |
parent | 54aee8ec965269faa485f856aba0afd15389306e (diff) | |
download | geiser-c08d3d8fd11c8713f0d418431b5c8595667879a0.tar.gz geiser-c08d3d8fd11c8713f0d418431b5c8595667879a0.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.el | 11 |
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))) |