GNU bug report logs - #15298
24.3.50; Background color lost when highlighting a string

Previous Next

Package: emacs;

Reported by: "Sebastien Vauban" <sva-news <at> mygooglest.com>

Date: Sat, 7 Sep 2013 10:48:01 UTC

Severity: normal

Tags: notabug

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 15298 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: "Sebastien Vauban" <sva-news <at> mygooglest.com>
Cc: 15298 <at> debbugs.gnu.org
Subject: Re: bug#15298: 24.3.50;
 Background color lost when highlighting a string
Date: Wed, 13 Nov 2013 23:01:45 -0500
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.




This bug report was last modified 11 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.