0

I'm trying to write a regex for a font-lock command. I want the font-lock to apply to all characters following '!', until the end of line or a comment, starting with '#', but the font-lock is turned off for the whole line after I enter any characters following '#'.

Currently I have this:

("!.*[^#+?]" . font-lock-custom-face)

! this works as expected #
! but here the font-lock # breaks

In the latter example, the comment is colored, but the line before it is not.

This works fine for a line without a comment, but the font-lock only 'ignores' the '#' sign, not the characters following it. How could I make the comment longer than just the '#' character, without breaking the font-lock on the part of the line preceding the comment?

Hessu
  • 49
  • 6
  • Are `!...` lines comments as well (similar to https://emacs.stackexchange.com/questions/47276)? – Stefan Jan 23 '19 at 19:46
  • Yes, sorry about the other post (its mine...). I accidentally posted the question as guest. But no, I think they should not be comments. I just want the lines starting with `!` to be different color. I want to be able to comment the lines out with `C-x M-;`. – Hessu Jan 24 '19 at 11:16

0 Answers0