unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Adding a font-lock face to a major mode
@ 2006-01-04 17:16 Tim Johnson
  2006-01-05  2:07 ` Adding a font-lock face to a major mode/revisited Tim Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Johnson @ 2006-01-04 17:16 UTC (permalink / raw)


Hi:

I would like to be able to add a font-lock face to a major mode at load
time.

I've written the following code in a file called lisp-mode++. 
I need some help in adding the face properly.
FYI: *If possible*, I'd like this to be cross-compatible to Xemacs.
      but is not a critical need.
;; code follows:
(defconst tj-word-end "\\)\\b")
(defconst tj-word-begin "\\b\\(")
(defconst tj-lisp-user-keywords 
          (concat tj-word-begin ;; test some symbols not highlighted
                  (regexp-opt '( "and" "apply" "concatenate" "format" "funcall" "list" "lambda" 
                                 "mapcar" "not" "print" "push" "return-from " "setf" "setq")) 
                  tj-word-end))
(add-hook 'lisp-mode-hook
          '(lambda ()
             (require 'extra-faces) ;; font-lock-user-keyword-face defined here
             'turn-on-font-lock
             (cons font-lock-defaults  ;; this is wrong, I know!
                   (list tj-lisp-user-keywords '1 'font-lock-user-keyword-face))
             (message "lisp-mode++ loaded")))   ;; test!
(provide 'lisp-mode++) ;; .emacs has (require 'lisp-mode++)
;;

TIA
tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-05 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04 17:16 Adding a font-lock face to a major mode Tim Johnson
2006-01-05  2:07 ` Adding a font-lock face to a major mode/revisited Tim Johnson
2006-01-05  2:11   ` Tim Johnson
2006-01-05 16:38   ` Kevin Rodgers

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).