From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.devel Subject: RFC: A "markup mode" Date: Sun, 13 Jul 2008 23:04:49 +0200 Message-ID: <20080713210449.GA29258@tomas> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1215982849 17107 80.91.229.12 (13 Jul 2008 21:00:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Jul 2008 21:00:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 13 23:01:36 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KI8hL-00049g-1q for ged-emacs-devel@m.gmane.org; Sun, 13 Jul 2008 23:01:35 +0200 Original-Received: from localhost ([127.0.0.1]:51090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KI8gS-0002OU-Km for ged-emacs-devel@m.gmane.org; Sun, 13 Jul 2008 17:00:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KI8gO-0002MH-Cf for emacs-devel@gnu.org; Sun, 13 Jul 2008 17:00:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KI8gN-0002Kz-1J for emacs-devel@gnu.org; Sun, 13 Jul 2008 17:00:36 -0400 Original-Received: from [199.232.76.173] (port=33228 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KI8gM-0002Kr-M0 for emacs-devel@gnu.org; Sun, 13 Jul 2008 17:00:34 -0400 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:37738 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KI8gM-00034A-EW for emacs-devel@gnu.org; Sun, 13 Jul 2008 17:00:34 -0400 Original-Received: by www.elogos.de (Postfix, from userid 1000) id DC0679006B; Sun, 13 Jul 2008 23:04:49 +0200 (CEST) Content-Disposition: inline User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100646 Archived-At: -----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=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIem3xBcgs9XrR2kYRAjpVAJ92PEqzPJWGYN7TRqt/N0Rgl0JKrACdFXTs nfJo/PESQOrhO2uUeHAfFQc=3D =3DiHJz -----END PGP SIGNATURE-----