Search code examples
emacscustomizationjitfont-lock

Is it possible to inhibit font-locking for a specific buffer region?


In a follow-up question to my previous question, is it possible to inhibit font-locking for a specific region in a buffer? I've looked through the special text properties portion of the manual, but couldn't find any properties that appeared to disable fontification. Is there another mechanism?

As an example, could font-lock be disabled for just the first line or two of a buffer?


Solution

  • There's no specific support for that, no.

    You can try to abuse the font-lock-extend-region-functions, but you'll need to be extra careful to try and avoid inf-loops where one font-lock-extend-region-function tries to extend the region and you shrink it back ad-nauseam.