help-gnu-emacs
[Top][All Lists]
Advanced

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

set face for added font lock keywords


From: extronom
Subject: set face for added font lock keywords
Date: Sun, 9 Jan 2011 07:27:30 -0800 (PST)
User-agent: G2/1.0

I'm trying to add some new keywords by doing  font-lock-add-keywords
so that a FIXME keyword gets highlighted, which works quite well. When
I try to change the color of the used face it doesn't work and
probably somebody could give me a hint what the problem is here (I'm
still a newbie regarding elisp programming).

Here is a function which is suppose to create a new buffer and add the
appropriated keyword regexp to be highlighted then but the color can't
be changed here it seems why? Maybe I'm missing some basic stuff here?

(defun my-new-buffer-color ()
  (interactive)
  (setq myBuffer (generate-new-buffer "myTemp"))
  (switch-to-buffer myBuffer)

  (lisp-interaction-mode)

  (font-lock-mode 0);; does not seem to help here???

  ;; this is supposed to work but doesn't???
  (set-face-foreground 'font-lock-comment-face "green" )
  (set-variable font-lock-comment-face 'font-lock-comment-face)

  ;; highlight FIXME
  (font-lock-add-keywords nil
    '("\\<FIXME\\>" 1 font-lock-comment-face prepend))

  (insert "this is a FIXME test \n")
)

Thanks for any help / hint.

Br


reply via email to

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