I can't believe it would be hard for font-lock to check if text it
wants to work with has an ignore-me property.
Nobody asks you to believe it would be hard.
To show what I meant, here's a naive implementation that seems to work.
1. In font-lock.el, use this everywhere that `put-text-property' is used
now:
(defun put-text-property-unless-ignore (start end property value &optional
object)
"`put-text-property', but ignore text with property `font-lock-ignore'."
(let ((here (min start end))
(end1 (max start end)))
(while (< here end1)
(unless (get-text-property here 'font-lock-ignore object)
(put-text-property here (1+ here) property value object))
(setq here (1+ here)))))
2. In font-lock.el, use this definition of
`font-lock-default-unfontify-region':
(defun font-lock-default-unfontify-region (beg end)
"Unfontify from BEG to END, unless text with property `font-lock-ignore'."
(let ((here (min beg end))
(end1 (max beg end)))
(while (< here end1)
(unless (get-text-property here 'font-lock-ignore)
(remove-list-of-text-properties
here (1+ here) (append font-lock-extra-managed-props
(if font-lock-syntactic-keywords
'(syntax-table face font-lock-multiline)
'(face font-lock-multiline)))))
(setq here (1+ here)))))
That is enough to get the behavior I described: putting a `font-lock-ignore'
property on selected portions of text tells font-lock "hands off". Try it,
for instance, with highlighting from `facemenu-set-face' (`M-o o') - see end
of mail.