I would like to highlight some parts of the code with a specific background color, but I would like the rest of the code highlighting to stay in place. Ie, keywords should still be highlighted using font lock as keywords, only their background should change.
I am currently doing this with font-lock-add-keywords, where regexp matches what I want to highlight, and to each match it adds a face defined like this:
(:background "#d1eaff")
But when he adds this face, he does not preserve previous attributes, such as the foreground color, and simply uses the default face with this background color.
Is there a way to make it use the current faces and replace only their background colors with a new one? How to add a new attribute to existing faces?
source
share