Subject: bug#19720: 24.4; minor mode's font-lock-add-keywords & auto-mode-alist problem

From: Glenn Morris <[email-masked]>
Date: Wed, 28 Jan 2015 21:42:40 -0500

Joost Kremers wrote:

> Font lock keywords added with `font-lock-add-keywords' in a minor mode's
> activation function do not work when the minor mode is activated in a
> major mode's hook and the major mode is activated through an entry in
> `auto-mode-alist'.

The minimal example works fine:

emacs-24.4 -Q -l foo.el foo.txt

where foo.el has contents:

  (define-minor-mode foobar-mode "blah" :initial-value nil
    (font-lock-add-keywords nil '(("foobar" . 'font-lock-warning-face))))

  (add-hook 'text-mode-hook 'foobar-mode)

and foo.txt contains:

  foobar

foobar gets font-lock-warning-face.

So your problem may be specific to your specific modes.