I want to debug data structures and/or algorithms visually in inferior buffers (mainly python and haskell, but any interpreter running in a buffer should be the same).
For this I would like to have a mechanism for setting display properties, creating images via markup. For example in a python inferior buffer:
<dot>
digraph G {Hello->World}
</dot>
*foo* _quux_
should be replaced with an image that contains the rendered graph followed by bold text foo, and underlined text quux.
(Of course the xml like notation for the image and the news like for the text is just an idea, any other notation is OK.)
Rendered/raw view should be switchable, and IMHO it should be be a minor mode, so it can be enabled without losing the functionality of the inferior mode.
Does something like this already exist? If not, how should I start, what documentation, code, examples to read?
I’m not sure if this is done completely but a couple of things come to mind. Emacs Muse mode has (if my memory serves me correctly) a tag which allows arbitrary lisp code to be executed at that point. Perhaps you can look at that and adapt it for your purposes. Similarly, the popular
org-modehas the concept of a dynamic block which will update when a function is called. You might be able to adapt that as well.The inferior process buffers can’t directly be manipulated but it might make sense to write a major mode that’s a wrapper on top of it in which case, take a look at http://www.emacswiki.org/emacs/ModeTutorial.