From c08d3d8fd11c8713f0d418431b5c8595667879a0 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sun, 12 Aug 2012 12:32:03 -0600 Subject: [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: # On the geiser side, we add a comint post-output hook to search for that filename and replace it with inline images. --- elisp/geiser-repl.el | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'elisp') 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 "#" 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))) -- cgit v1.2.3