unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: tomas@tuxteam.de
To: emacs-devel@gnu.org
Subject: RFC: A "markup mode"
Date: Sun, 13 Jul 2008 23:04:49 +0200	[thread overview]
Message-ID: <20080713210449.GA29258@tomas> (raw)

-----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	other threads:[~2008-07-13 21:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-13 21:04 tomas [this message]
2008-07-29 10:50 ` RFC: A "markup mode" tomas
2008-07-29 10:57   ` Miles Bader
2008-07-29 12:39   ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080713210449.GA29258@tomas \
    --to=tomas@tuxteam.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).