emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enriched-mode and switching major modes.


From: Oliver Scholz
Subject: Re: enriched-mode and switching major modes.
Date: Thu, 23 Sep 2004 14:59:19 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt)

Stefan <address@hidden> writes:

[overlays for implementing a document tree]
>
>> Overlays are no good for this because they will be lost completely
>> if you cut and paste.  If you copy the text of a buffer
>> to another buffer, the overlays won't come along.  (That is the purpose
>> of overlays.)
>
>> This information has to be *part of the text*.

I agree, in general, for conceptual reasons. Yet, overlays in many
ways fit the job description: they are first class Lisp objects
specifying properties for a range of text.  For implementing a tree
data structure, they don't fit in the one respect that overlays on the
same level (depth) of the tree may overlap.  But maybe that won't be a
problem.

What I also like is that I can delay the decision whether to find the
children or the parent of a node in the buffer each time I want to
access them.  Or whether I keep references to both on the node.
Overlays allow for both.

And finally, they allow me to store character formatting properties on
tree nodes in a way that Emacs will automagically resolve them for me.

That text is copied without the overlays is not that much of a
problem.  With text properties I'd have to remove those applying to a
block only anyways.  Thus for overlays it is just the inverse. On the
contrary, if in doubt, the lesser evil is to copy the pure characters
without properties.

> XEmacs's version of overlays (called extents) can be part of the text
> (which is a property they call `duplicable').  We could do the same.

After spending some more thought on it, I think I can hide the actual
implementation of the abstract tree-like data structure behind an
interface. Thus we can delay any decision in this point.  There won't
happen anything before the next release, anyways.  For now I think,
I am going to work with overlays.


                        implementation of the
                        data structure
                                ^
 document                       v
 structure              Specification of the abstract
    +-----------------> tree data structure and      ----+
    |                   interface to it                  |
    |                           ^                        |
    |                           |                        |
    |                           |                        v
file decoding --------> applying stylesheets   resolving formatting
               formatt.                        properties for visual
               inform.                         appearance
                                                 - character formatting
                                                 - whitespace formatting


    Oliver
--
Oliver Scholz               2 Vendémiaire an 213 de la Révolution
Ostendstr. 61               Liberté, Egalité, Fraternité!
60314 Frankfurt a. M.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]