Some of my modes use overlays for contextual information.

However, I have a face that I'd like to always be shown despite any overlays on top of it. Is there any way to have such a "super face"?

  • 1
    This is not about faces vs overlays. Overlays use faces for highlighting. Please edit your question to make clear that you are talking (presumably) about text property face vs overlay property face. Presumably the text property you are talking about is the result of font-lock (syntax highlighting). [And the answer is, as @lunaryorn said, that overlay property face has priority over text-property face.] – Drew Jan 5 '16 at 0:01

If you want a whitespace warning face to win, then use an overlay for that face, and give it a higher priority value than the overlay you want to shadow.

You can use library Highlight to do this. It lets you highlight using text properties or overlays (or both).

  • ok, so it looks like I might be able to use Highlight to detect the faces that I want to have priority, and then add an overlay (with the same settings as the face) with a higher priority than everything else. Might have to set an evening aside for that, and I'm a little concerned that it might impact rendering performance in general... you wouldn't happen to know a short recipe? – fommil Jan 5 '16 at 10:19
  • I don't know a short recipe. There is no way to make font-lock use overlays, AFAIK. Face overlays are really intended to add highlighting "on top of" text property face. They are properties of the buffer (buffer positions) and not properties of characters in the buffer. And overlays can have considerable performance issues. – Drew Jan 5 '16 at 14:26

I don't think so. That'd defeat the purpose of overlays.

I think you must also use an overlay, with a high priority to make sure that it appears on top of everything else.

  • that's a shame. the face I want to win is a whitespace warning face, which I want to always win (and it's real ugly) when lines are too long. – fommil Jan 4 '16 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.