Jason Rumney wrote: > Lennart Borgman (gmail) wrote: >> I have attached the relevant pieces from rng-valid.el. I think this is >> much easier to understand as one piece than as a diff. > > It may be so for you, who wrote the changes, but for anyone else who > does not know what you've changed, a diff is much easier. Ok, here comes the diff. It is noteworthy that I actually use nxml-mode just to parse the buffer when it tie it together with mumamo. You can not see that in this diff, since turning of the nxml-mode fontification is done in mumamo. After "finishing" the change I sent here to rng-valid.el I realize I can now use the fontification from nxml-mode together with mumamo. That was not possible before because the nxml-mode fontification would then override fontification in chunks of the buffer with other major modes. Daniel, I am starting to wonder if that is possible with your changes. I actually wonder if I can use the parser from nxml-mode at all. I have not thought much about it but it is not clear to me how it can be done yet. My thoughts on this matter before has been that perhaps a two step approch to fontification would be good: - In the first pass a font-lock keyword fontification would be done. - In the second step a parser like nxml-mode or js2 mode could make it a little bit better. This would mean that the parser have to cooperate with font-lock in some way. I do not know how, but the font-lock/jit lock frame work could possible be extended to do handle the cooperation. I think however that there perhaps is no need for the parser to know about fontify-region. It would rather need to know things like how to tell font-lock what it has done and where major mode chunks are. (Mumamo does the major mode chunk dividing in font-lock-fontify-region-function.)