Martin Duerst wrote:
At 22:13 05/11/30, Gregg Reynolds 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.
I haven't looked at the actual nxml source, but otherwise,
that's very much what I have thought about.
Take a look at xmltok.el, starting at "defun xmltok-r". It uses a
clever but somewhat hairy method using "symbolic regexp"s and macros to
handle regexps and get at match data for parsing. Make sure you
understand what a "symbolic regexp" is (explained in the code). Pay
special attention to xmltok+, xmltok-g, and especially xmltok-defregexp.
The key macro definition for parsing attributes is
(xmltok-defregexp
xmltok-attribute
(let* ...
This creates the symbolic regexp "xmltok-attribute" which is used for
parsing. Note that where it is used, it looks like a function e.g.
(xmltok-attribute regexp)
but it's actually a macro thingee.
My hunch is that we could set some bidi-related text properties for
att-val delimiters here:
(defun xmltok-scan-attributes ()
(let ((recovering nil)
(atts-needing-normalization nil))
(while (cond ((or (looking-at (xmltok-attribute regexp)) ;GAR: add
bidi attrs here?
;; use non-greedy group
I hope that helps; I haven't looked much beyond that. You mentioned
your students; I'm a lightweight when it comes to Elisp, but studying
nxml looks like a very good way to become a master elisp hacker. It
exercises lots of elisp stuff in interesting ways. There's also an nxml
list somewhere.
-gregg
_______________________________________________
emacs-bidi mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-bidi