I have some code that I borrowed from a long while ago that sets a long-line face when the line is too long:
(add-hook 'font-lock-mode-hook
(function
(lambda ()
(setq font-lock-keywords
(append font-lock-keywords
'( ("^.\\{133,\\}$" (0 'my-long-line-face t))
)
)
)
)
))
(I know about font-lock-add-keywords now, BTW; like I said, this is kind of old.)
The problem is that this changes the face of the entire line. So if I indicate that long-line-face is bold, I lose all the contextual customization of the line, and it appears in the default face, but bold.
How would I get it to keep the contextual colouring but make everything bold?
You are overriding the fontification with the t
in your font-lock spec. Try changing the (0 'my-long-line-face t)
to either (0 'my-long-line-face prepend)
or (0 'my-long-line-face append)
.