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

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

Re: Adding a font-lock face to a major mode/revisited


From: Kevin Rodgers
Subject: Re: Adding a font-lock face to a major mode/revisited
Date: Thu, 05 Jan 2006 09:38:04 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Tim Johnson wrote:
> (make-local-variable 'lisp-font-lock-keywords-tj)

Why?

> (add-hook 'lisp-mode-hook
>           '(lambda ()
> (require 'extra-faces) ;; font-lock-user-keyword-face defined here
>              'turn-on-font-lock

That quoted symbol inside the lambda body has no effect whatsoever.  I
think you want to call the function, so either do so: (turn-on-font-lock)
or add it as a separate hook: (add-hook 'lisp-mode-hook 'turn-on-font-lock)

>              ;; I have tried both of the lines below, with no good effect
> (put 'lisp-mode 'font-lock-defaults '(lisp-font-lock-keywords-tj))
>              ;(cons font-lock-defaults lisp-font-lock-keywords-tj)

I don't see anything in the documentation that suggests that the
font-lock-defaults property of a major-mode has any effect.  I think you
want:

(set (make-local-variable 'font-lock-defaults) lisp-font-lock-keywords-tj)

or perhaps:

(set (make-local-variable 'font-lock-defaults)
     (append font-lock-defaults lisp-font-lock-keywords-tj))

>              (message "lisp-mode++ loaded")))

--
Kevin Rodgers





reply via email to

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