> Thanks, Stefan.  That makes sense.  But it would need to run within the
> fontification function, so we'd like it to be speedy...
Try it.  It's not at all obvious to me that performance will be a problem.
I'm often surprised at how much work one can do within font-lock without it
having any noticeable impact.
        Stefan