[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15298: 24.3.50; Background color lost when highlighting a string
From: |
Glenn Morris |
Subject: |
bug#15298: 24.3.50; Background color lost when highlighting a string |
Date: |
Wed, 13 Nov 2013 23:01:45 -0500 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Minimal example:
(defface foo '((t :foreground "blue" :background "yellow"))
"foo face")
(define-derived-mode foo-mode nil "foo"
"foo doc"
(set (make-local-variable 'font-lock-defaults)
'((("^FOO.*" . 'foo)))))
(font-lock-add-keywords 'foo-mode '(("bar" 0 'underline prepend)))
Eval that, M-x foo-mode, enter
FOO text bar text
As soon as "bar" is entered, "FOO..." loses its highlighting.
It works if you use instead:
(font-lock-add-keywords 'foo-mode '(("bar" 0 'underline prepend)) 'end)
Another approach that works is:
(define-derived-mode foo-mode nil "foo"
"foo doc"
(set (make-local-variable 'font-lock-defaults)
'((("^FOO.*" 0 'foo append))))) ; note addition of "append" here
(font-lock-add-keywords 'foo-mode '(("bar" 0 'underline)))
So I think this is not a bug, just a confusing aspect of the way
font-lock-keywords is applied in order.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#15298: 24.3.50; Background color lost when highlighting a string,
Glenn Morris <=