unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: "Sebastien Vauban" <sva-news@mygooglest.com>
Cc: 15298@debbugs.gnu.org
Subject: bug#15298: 24.3.50; Background color lost when highlighting a string
Date: Wed, 13 Nov 2013 23:01:45 -0500	[thread overview]
Message-ID: <94fvqzk4wm.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <86d2oksye6.fsf@somewhere.org> (Sebastien Vauban's message of "Sat, 07 Sep 2013 12:45:53 +0200")


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.





  reply	other threads:[~2013-11-14  4:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-07 10:45 bug#15298: 24.3.50; Background color lost when highlighting a string Sebastien Vauban
2013-11-14  4:01 ` Glenn Morris [this message]
     [not found] ` <mailman.6032.1384401725.10748.bug-gnu-emacs@gnu.org>
     [not found]   ` <mailman.6032.1384401725.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-13 12:50     ` Sebastien Vauban
2013-12-13 14:11       ` Eli Zaretskii
2013-12-13 16:14         ` Josh
2013-12-13 18:45           ` Eli Zaretskii
2013-12-13 20:21             ` Josh
     [not found]       ` <mailman.9107.1386943937.10748.bug-gnu-emacs@gnu.org>
     [not found]         ` <mailman.9107.1386943937.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-13 15:41           ` Sebastien Vauban
2013-12-13 16:08             ` Eli Zaretskii
2013-12-13 16:41             ` Stefan Monnier
     [not found]               ` <jwvk3f83dsp.fsf-monnier+emacsbugs-mXXj517/zsQ@public.gmane.org>
2013-12-13 19:02                 ` Sebastien Vauban
2013-12-14  2:17                   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94fvqzk4wm.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=15298@debbugs.gnu.org \
    --cc=sva-news@mygooglest.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).