[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Defining and using custom faces and keywords

From: suvayu ali
Subject: Defining and using custom faces and keywords
Date: Mon, 19 Mar 2012 13:38:02 +0100


I wanted to add custom keywords and highlight them with my custom face
on all buffers. So I tried something like this.

;; font-lock customisations
(defface font-lock-global-todo-face
  '((t (:background "royalblue4" :foreground "thistle" :weight bold)))
  "Face for the TODO keyword globally."
  :group 'font-lock-faces)

(add-hook 'find-file-hook
          (lambda ()
             nil '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)))
             nil '(("\\<\\(TODO\\):" 1 font-lock-global-todo-face prepend))))
             nil '(("\\<\\(NB\\):" 1 font-lock-global-todo-face prepend))))

I was expecting FIXME: to be displayed with font-lock-warning-face in
all buffers and TODO: and NB: to be displayed with
font-lock-global-todo-face. However only FIXME: is displayed as
expected. When I check the value of font-lock-global-todo-face with
customize-face, I see the correct value with the sample text displayed
as I expect. What could be going wrong here? Am I missing any steps in
defining my custom face?

Thanks in advance.


Open source is the future. It sets us free.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]