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: Re: Adding a font-lock face to a major mode/revisited Date: Wed, 4 Jan 2006 17:11:57 -0900 Message-ID: <20060105021157.GI1812@johnsons-web.com> References: <20060104171625.GF1812@johnsons-web.com> <20060105020747.GH1812@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 1136427126 4447 80.91.229.2 (5 Jan 2006 02:12:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 5 Jan 2006 02:12:06 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 05 03:12:02 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 1EuKbf-0003GT-7v for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jan 2006 03:12:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EuKdM-00082z-SL for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2006 21:13:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EuKdB-00082r-Ja for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 21:13:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EuKd9-00082f-MX for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 21:13:33 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EuKd9-00082c-JG for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 21:13:31 -0500 Original-Received: from [208.218.214.5] (helo=postoffice.cniweb.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EuKee-0006ZM-Bq for help-gnu-emacs@gnu.org; Wed, 04 Jan 2006 21:15:04 -0500 Original-Received: from linus.johnson.com (rdbck-static-445.palmer.mtaonline.net [64.4.232.191]) by postoffice.cniweb.net (8.13.5/8.13.5) with ESMTP id k052B5XP026843 for ; Wed, 4 Jan 2006 21:11:06 -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 k052BvZt011111 for ; Wed, 4 Jan 2006 17:11:57 -0900 Original-Received: (from tim@localhost) by linus.johnson.com (8.12.8/8.12.8/Submit) id k052Bvs2011109 for help-gnu-emacs@gnu.org; Wed, 4 Jan 2006 17:11:57 -0900 Original-To: help-gnu-emacs@gnu.org Mail-Followup-To: Tim Johnson , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <20060105020747.GH1812@johnsons-web.com> 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:32436 Archived-At: * Tim Johnson [060104 17:09]: There is a typo here: where I said: > Unfortunately I have not yet found any examples to work from. I suspect > that neither the 'put nor the 'cons calls are wrong. I meant to say that it appears that neither the 'put nor the 'cons cells are correct. Ssoorryy! tj > After studying documentation, I have taken a different approach. > Code for lisp-mode++.el is not as follows: > ;; > (defconst tj-word-end "\\)\\b") > (defconst tj-lisp-user-keywords > (concat tj-word-begin > (regexp-opt '("and" "apply" "concatenate" "format" "funcall" "list" "lambda" > "mapcar" "not" "print" "push" "return-from " "setf" "setq") > ) tj-word-end)) > (make-local-variable 'lisp-font-lock-keywords-tj) > (defvar lisp-font-lock-keywords-tj > (list > (list tj-lisp-user-keywords '1 'font-lock-user-keyword-face)) > "Additional keywords and groups for lisp-mode") > (add-hook 'lisp-mode-hook > '(lambda () > (require 'extra-faces) ;; font-lock-user-keyword-face defined here > '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) > (message "lisp-mode++ loaded"))) > (provide 'lisp-mode++) ;; .emacs has (require 'lisp-mode++) > ;; > What works: > 'add hook is being executed. > I see the message > Even with "debug on error" turned on, there are no errors. > the 'require form is being evaluated as > 'font-lock-user-keyword-face appears as a defined variable. > lisp-font-lock-keywords-tj appears as a defined variable. > The regex part of the variable seems to work as tested with > re-builder > What doesn't work: > No syntax highlighting appears for the keywords. > c-h v font-lock-defaults => provides a printed representation > that does not show lisp-font-lock-keywords-tj as a component of > that variable. > > Unfortunately I have not yet found any examples to work from. I suspect > that neither the 'put nor the 'cons calls are wrong. > > Any help would be appreciated. > tim > > -- > Tim Johnson > http://www.alaska-internet-solutions.com > > > _______________________________________________ > help-gnu-emacs mailing list > help-gnu-emacs@gnu.org > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs -- Tim Johnson http://www.alaska-internet-solutions.com