|
From: | Gregg Reynolds |
Subject: | Re: [emacs-bidi] Re: Callbacks? |
Date: | Wed, 30 Nov 2005 07:13:08 -0600 |
User-agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Martin Duerst wrote:
Have you taken a look at the source for nxml mode? You might be able to hack it up do do something like this. As I understand it, in Emacs you can set whatever properties you like on each character in a buffer. See node 32.19, "Text Properties", of the Elisp manual.Good to know. The following are potential problems: - Can the properties be set for each mode individually? - Can the properties change based on context? As a simple example, attributes in XML can be quoted with single quotes or with double quotes. In the attribute value, the 'other' quote can then be used literally. So if we have something like <element attr1="What's up?" attr2='He cried "Help!" and ran away.' /> 1 2 1 1 2 2 1 then for the places marked 1, which are XML syntax, we want to change the properties (e.g. to LTR), but for the cases marked with 2, which are content, we do not want to change the properties. Would such a thing be possible? - In our current approach, we not only change the properties of some characters, but also introduce additional embedding (or occasionally override) levels. Is this possible in your implementation?
Now the interesting possibility presents itself, which is to add Unicode-related "special" (ie. built-in) text properties. In particular, directional class. Then allow the user to override the Unicode-defined class for any particular character or set of chars in a buffer. So in your example above, the nxml parser identifies weakly directional chars in the XML syntax, and switches their "unicode-directionality" property to strong LTR. Voila! The bidi reordering obeys the user-set directionality and does the right thing.
-g
[Prev in Thread] | Current Thread | [Next in Thread] |