From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.devel Subject: Re: enriched-mode and switching major modes. Date: Fri, 24 Sep 2004 13:53:33 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <200409042358.i84Nwjt19152@raven.dms.auburn.edu> <87llfn5ihw.fsf@emacswiki.org> <01c49c75$Blat.v2.2.2$7a37cb00@zahav.net.il> <01c49d70$Blat.v2.2.2$f7cfb860@zahav.net.il> <01c49da7$Blat.v2.2.2$cd5f7160@zahav.net.il> <01c49dc6$Blat.v2.2.2$3b624d40@zahav.net.il> <01c4a225$Blat.v2.2.2$a NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1096026986 16580 80.91.229.6 (24 Sep 2004 11:56:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2004 11:56:26 +0000 (UTC) Cc: boris@gnu.org, emacs-devel@gnu.org, alex@emacswiki.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 24 13:56:09 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CAogL-0003QR-00 for ; Fri, 24 Sep 2004 13:56:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAomQ-0001QA-Bs for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2004 08:02:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CAokS-0000uN-KE for emacs-devel@gnu.org; Fri, 24 Sep 2004 08:00:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CAokO-0000s2-Dj for emacs-devel@gnu.org; Fri, 24 Sep 2004 08:00:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAokL-0000qI-Js for emacs-devel@gnu.org; Fri, 24 Sep 2004 08:00:19 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1CAodx-00046n-KJ for emacs-devel@gnu.org; Fri, 24 Sep 2004 07:53:42 -0400 Original-Received: (qmail 1174 invoked by uid 65534); 24 Sep 2004 11:53:36 -0000 Original-Received: from dsl-084-057-008-174.arcor-ip.net (EHLO USER-2MOEN8BWBA.gmx.de) (84.57.8.174) by mail.gmx.net (mp011) with SMTP; 24 Sep 2004 13:53:36 +0200 X-Authenticated: #1497658 Original-To: Eli Zaretskii In-Reply-To: <01c4a225$Blat.v2.2.2$afcaa700@zahav.net.il> (Eli Zaretskii's message of "Fri, 24 Sep 2004 12:59:19 +0200") X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt) 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:27534 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27534 "Eli Zaretskii" writes: >> From: Oliver Scholz >> Date: Wed, 22 Sep 2004 12:01:27 +0200 >> Cc: boris@gnu.org, eliz@gnu.org, alex@emacswiki.org, emacs-devel@gnu.org >> >> For simplicity, I focus on elements and character data here and talk >> about them as "nodes" in a tree; thus we have "element nodes" and >> "text nodes". An XHTML fragment like >> >>

Some meaningless text

>> >> Would be regarded as a `h1' element node which has three children: a >> text node "Some ", an element node `em' (which has itself a text node >> as its single child) an another text node " text". > > I'm not sure I understand why you want a tree-like representation for > that. Is it only so you can find what you call ``the immeditate > parent of the current node''? Since I don't want to render a given XML document /only/, but to make it /editable/ also, I have to preserve the structure/the information contained in the original document. There is no requirement that the data structure is a tree in a strict sense immediately (in fact, the XML information set spec explicitely states that this is not required). But it must be possible to map a tree into that data structure and to map that data structure into a tree; so that the original tree is regenerated after doing both. The data structure that I presented as #2 is actually not a tree in itself (no link to the parents and children on a node); but I can compute tree-like relations from it. > Perhaps it would be better to step back for a moment and describe the > operations you will need to perform on fragments of the document text, > and only _then_ think about an appropriate data structure. I am not sure that I understand what you mean here. First and foremost I want that data structure to preserve the information contained in a specific file format (here: XML). Then, to implement CSS I need an interface to whatever data structure I use that presents it as a tree. > The fact that the XML people came up with a tree does not mean you > should follow suit; there might be other appropriate data > structures. For example, why not a list (which is a native data > structure in ELisp)? Lists are fine in general: '(h1 "some " (em "meaningless") " text") SXML uses lists in a similar way to represent the XML information set. Emacs Lisp XML parsers that generate similar lists include: nxml-parse.el, xml.el and xml-parse.el. That nodes have no reference to their parent in a non-circular list is not much of a problem, because for a given node, I can find its parent by scanning the list. So the information is preserved. The solution I presented as #1 could be implemented this way by representing text nodes as a unique Lisp object that is put into a `text-node' text property. In fact, I intended for a long time to do it exactly like this (using SXML). But I distrust the robustness of this solution. (After some thought I also realized that using SXML is a bit pointless, but that is another issue, probably not relevant here.) Oliver -- Oliver Scholz 3 Vendémiaire an 213 de la Révolution Ostendstr. 61 Liberté, Egalité, Fraternité! 60314 Frankfurt a. M.