[Originally sent to the nxml mailing list] I've converted nxml to font-lock. I used the existing fontification machinery and put it inside a cc-mode-style matcher. Efficiency and output are the same, but: 1) hi-lock-mode works now 2) all conventional font-locking functions work as expected. For example, you can turn fontification on and off with M-x font-lock-mode. 3) font-lock-add-keywords DTRT 4) multiple-major-modes modes should be able to use nXML fontification now, though this remains untested I've also added a new function: nxml-debug-region: Interactive function. Activate the region and call nxml-debug-region. The new region is what nxml thinks should be re-fontified if the original region is changed. The new code probably works only on Emacs 22. Lightly tested, but it seems to handle corner highlighting cases fine. I removed a bunch of code that was "for redisplay", since I'm assuming font-lock handles those funky bits. In addition to the patch, I've attached a set of files that demonstrates extending nXML mode to work with the Genshi template engine. The examples ought to work with some slight modification of the embedded paths. (Does the Relax NG compact syntax offer a way to say "include the next file for this document type"?)