[plt-scheme] How to store extra data in text% editor

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon May 22 10:10:08 EDT 2006

At Sat, 20 May 2006 15:07:17 +0200, "pascal.delcombel" wrote:
> I'm trying to use MrEd to develop a little tool to store text, including the 
> Hyperlinks facilities. As documented, I'd like to store text information (with 
> the text% editore class), including some hyperlinks.
> I tried to derive new classes from editor-data% and editor-data-class%, then I 
> wrote a new class from the text% class, and tried to override the set-region-
> data and get-region-data methods.
> Well, I'm puzzled, I don't know what is really the classes hierachy and 
> thefore I struggle in understanding when and where to store the hyperlink (in 
> the write method from the editor-class? Elsewhere?)

The docs were certainly unclear on the following two points:

 * The `set-snipclass' and `get-snipclass' methods are not meant to be
   overridden. The `set-snipclass' method stores the given class in a
   way that other editor objects access directly. So, you need to call
   the built-in method.

 * The `set-region-data' and `get-region-data' methods *are* meant to be
   overridden. The default `set-region-data' doesn't store anything.
   Instead these methods are called when content is unmarshaled or
   marshaled, respectively.

Meanwhile, if you just need to store hyperlinks when the text is saved
to a file, you'll need to record the data in a header or footer,
instead of as region data. It turns out that the region-data methods
are used for cut-and-paste, but they're not used for file saving and

I've improved the docs for the next build. Hopefully this information
will help you make progress, but don't hesitate to ask more questions.


Posted on the users mailing list.