On Wed, 18 Jan 2006 14:12:09 +0000
Felix Breuer <[EMAIL PROTECTED]> wrote:
 
> Hm... the way I see it, the two following things might be useful to
> have.
> 
> * Give TeXmacs itself the ability to rearrange snippets of verbatim
> text on the fly (i.e. to tangle code snippets). This could be roughly
> what I have done in LP4TeXmacs, only that it would be implemented in
> TeXmacs itself, so it could be used to generate code for interactive
> sessions as well.
> 
> * Implement a special import and export method that reads and writes
> the entire document in .tm format with the exception that all lines
> are commented (using the language specific syntax for commenting)
> except for the contents of some special purpose primitves which
> are exported verbatim.
> 
> The rub is that these two would _not_ work well together unless TeXmacs
> also had the ability to untangle, which is where the difficulties lie.

I think I have a good idea that might get us untangling for free:

What TeXmacs needs is clones (or pointers/references if you prefer).
What I mean by this is a way to have the same node appear at two or
more points in a document tree, while the content of that node is
only stored once (in memory as well as in serialized form).


A bit more concretely, I want the document tree to look like this:

<clone|someid123>
...
<\node|someid123>
    This is a cloned sentence.
                
        
</node>

While the visual output of TeXmacs produces is

  This is a cloned sentence.
  ...
  This is a cloned sentence.

and both clones are editable! Editing one changes the other, because
the content is only present once. 

Note 1: I am not proposing to switch from a document tree to a document 
graph or something like that.

Note 2: I have no idea how difficult to implement the above would be.


For use with literate programming, we would have two clones of every
code snippet. The one would reside in an "untangled" part of the document,
and the other would reside in the tangled part. Via some mechanism, we
could make sure that the content is actually stored in the tangled part
of the document, so that, given the new serialization format, we would
then get the tangled version of the code automatically. If the user
makes changes to the code via a text editor, there is no need to propagate
the changes to the untangled part, because the content is serialized only
once.

Apart from that, I am sure clones would have all kinds of uses! (They might
be very hard to implement, though.)

I also think this would be a very elegant approach to literate programming,
because there is no redundance at all. No source document and code files
or tangled and untangled versions to keep in sync.


Felix


_______________________________________________
Texmacs-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to