Hi Tassilo, Thank you for the quick fix. >>> Problem 1: the overlay context does not have font-lock, since >>> font-lock was not applied to the previous area that contains the >>> context. > > I now ensure the region is font-locked before taking the > buffer-substring(s). > I confirm that problem #1 is fixed. >>> Problem 2: the overlay context will be displayed with the same >>> background color as the top-left line of the window (yellow, in this >>> case, because of whitespace-mode). > > I now set the overlay priority to (the very high) show-paren-priority > which seems to do the trick. I can still reproduce the problem #2, where the overlay context use the same face of the top-left line. I suspect the issue is related to the overlay face, not with overlay priority (but we can keep your fix that set the overlay priority). A simpler recipe to reproduce the issue is to make sure the first character of the top-left line is a comment, so the overlay context will be displayed in that face (font-lock-comment-face). See the attached images, where I put a comment ("/* EXAMPLE COMMENT */") in the top-left line and the context overlay was displayed in that face.