emacs-devel
[Top][All Lists]
Advanced

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

Re: Saving markup formats


From: Nic James Ferrier
Subject: Re: Saving markup formats
Date: Thu, 21 Jun 2007 01:05:55 +0100

Nic James Ferrier <address@hidden> writes:

> Richard Stallman <address@hidden> writes:
>
>> I am against structured data formats for an Emacs buffer because there
>> is no way to reconcile that cleanly with the Emacs Lisp model of a
>> buffer as a string of text.  I thought about this thoroughly 15 years
>> ago.
>
> I don't *think* I'm talking about a data format in an emacs buffer.
>
> I'm talking about using properties to mark the syntax of pieces of
> text (in an ordinary buffer) as they are described in a word processor
> schema instance (a document).
>
>
> I think I'm just going to have to knock up an example and see whether
> it's viable.

Ok. I looked into it a bit more.

I don't think I'm talking about something that breaks the primacy of
the buffer. In fact, what I'm talking about has practically already
been done.

I am talking about writing a mode that works primarily on text
properties specified via what most word processors call style. Emacs
has a term for this as well: the category property.

  `category'
     If a character has a `category' property, we call it the
     "category" of the character.  It should be a symbol.  The
     properties of the symbol serve as defaults for the properties of
     the character.

That's really all I'm talking about.

Importing an OpenDoc (or in principle a Word document) into Emacs in a
way that would ensure that you could save it back to something not too
dissimilar would mean:

- read the opendoc XML

- convert all the styles to elisp symbols;

  some of these styles ("list-item", "p", etc...) would have well understood
  display; for example a heading needs to be display in bold or
  something. We could map standard Emacs display stuff onto the
  category symbols.

- read in the document content inserting just the text into the
  buffer

- propertize each piece of text, as you insert, with the name of the
  appropriate category; eg: if you have the following XML:

    <text:p text:style-name="Standard">Designed a REST binding for the
            SAML specification for single sign on web applications.</text:p>

  then that would be converted into the following text buffer content:

    Designed a REST binding for the SAML specification for single sign
    on web applications.

  and the text would have a property assigned:

    category Standard

  so as to record the origin structure we might also add the following
  property:

    element p

  or:

    element text:p

- let the user edit the text, editing would have to include the
  ability to add, remove or change the category property from/to text.

  cut and paste is not a problem. the text carries with it the
  properties it was assigned. That's fine. That's all word processor
  users expect.


This doesn't deal with more complex structure (say, where you have a
paragraph embedded in a list item) but I think that is possible quite
naturally as well.

I hope this answers some concerns. I think it shows that Emacs _could_
be a viable word processor for modern wp formats (and RTF as well).

But if people are still doubtfull I'll have to go away and do it (in
the 10seconds of free time I have every week).

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   




reply via email to

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