emacs-devel
[Top][All Lists]
Advanced

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

RFC: A "markup mode"


From: tomas
Subject: RFC: A "markup mode"
Date: Sun, 13 Jul 2008 23:04:49 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

for some time now I have been working on a generic markup mode for
Emacs. The work has been sped up by the needs of a customer, which might
be served by this code.

I've asked the customer and they would be fine with publishing wnatever
comes out of it under the GPL -- even better if it is adopted as part of
Emacs.

Please find the current incarnation here:

  git http://tuxteam.de/~tomas/Repositories/am

Some remarks:

Design:

The idea is to support (nested) mark-ups like XML or Wiki, rendering
them in a more-or-less WYSIWYG fashion (as far as Emacs supports that).
The mapping between the markup elements and rendering whithin Emacs is
done via a "style" file (which is at the moment just an elisp file
containing faces and assorted fix-ups for special cases. Several
examples of style files are contained in the above code sample.

The markup model is more or less what we know from XML: spans of text
are attached with a "markup class" and a (possibly empty) list of
attributes. Those spans may be empty (the "singletons" in XML).

Implementation:

To satisfy the constraints:

 - preserve document order (even for empty spans)
 - move around markup classes on copy/kill and yank
 - round trip invariance (i.e. what is written is in some sense
   "equivalent" to what has been read)

I ended up with an interesting mixture of overlays, text properties and
invisible "sentinel characters" (always at the beginning of spans: thus
a span is "never empty" in the implementation (helps keeping document
order).

The current implementation features an XML parser (ugh! I must be crazy
to write _yet_ another half-complete XML parser, right?), and is able to
display this XML according to the "style file", copy/yank "works",
nesting whatever markup is picked up at the copy site within the markup
present in the target site.

It is implemented as a minor mode (I'd hoped once to use it as "literate
programming sub-mode" within a programming major mode, to embellish
embedded documentation).

I'd love to hear criticism, ideas, whatever. Do you think something like
this could be useful?

NOTE: I'll be off the net for the next fourteen days. But I'm looking
forward to your comments.

Thanks
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIem3xBcgs9XrR2kYRAjpVAJ92PEqzPJWGYN7TRqt/N0Rgl0JKrACdFXTs
nfJo/PESQOrhO2uUeHAfFQc=
=iHJz
-----END PGP SIGNATURE-----




reply via email to

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