From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Adding a font-lock face to a major mode Date: Wed, 4 Jan 2006 08:16:25 -0900 Message-ID: <20060104171625.GF1812@johnsons-web.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1136399726 8049 80.91.229.2 (4 Jan 2006 18:35:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2006 18:35:26 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 04 19:35:20 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EuDTW-00008d-Iu for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 19:35:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EuDVC-0005WR-TD for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 13:36:50 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EuCH0-0007OF-Ox for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 12:18:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EuCGy-0007Lr-Mu for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 12:18:06 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EuCGy-0007LF-AA for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 12:18:04 -0500 Original-Received: from [208.218.214.44] (helo=ns3.cniweb.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EuCIO-0007Qn-Vp for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 12:19:33 -0500 Original-Received: from linus.johnson.com (rdbck-static-445.palmer.mtaonline.net [64.4.232.191]) by ns3.cniweb.net (8.13.5/8.13.5) with ESMTP id k04HFYCb015705 for ; Wed, 4 Jan 2006 12:15:35 -0500 (EST) Original-Received: from linus.johnson.com (localhost.johnson.com [127.0.0.1]) by linus.johnson.com (8.12.8/8.12.8) with ESMTP id k04HGPZt009332 for ; Wed, 4 Jan 2006 08:16:25 -0900 Original-Received: (from tim@localhost) by linus.johnson.com (8.12.8/8.12.8/Submit) id k04HGP9b009330 for help-gnu-emacs@gnu.org; Wed, 4 Jan 2006 08:16:25 -0900 Original-To: help-gnu-emacs@gnu.org Mail-Followup-To: Tim Johnson , help-gnu-emacs@gnu.org Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32422 Archived-At: 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 http://www.alaska-internet-solutions.com