From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: font-lock-add-keywords problem Date: Thu, 09 Mar 2006 16:57:59 -0500 Message-ID: <4410A4E7.6070008@speakeasy.net> References: <719707752@web.de> Reply-To: gebser@speakeasy.net NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1141941511 15502 80.91.229.2 (9 Mar 2006 21:58:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Mar 2006 21:58:31 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 09 22:58:29 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 1FHT9N-0007oJ-G0 for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Mar 2006 22:58:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHT9M-0007p6-UM for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Mar 2006 16:58:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FHT99-0007eQ-Hv for help-gnu-emacs@gnu.org; Thu, 09 Mar 2006 16:58:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FHT92-0006iz-Nb for help-gnu-emacs@gnu.org; Thu, 09 Mar 2006 16:58:11 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHT92-0006ik-KB for help-gnu-emacs@gnu.org; Thu, 09 Mar 2006 16:58:04 -0500 Original-Received: from [69.17.117.8] (helo=mail6.sea5.speakeasy.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FHTCB-0001zZ-H5 for help-gnu-emacs@gnu.org; Thu, 09 Mar 2006 17:01:19 -0500 Original-Received: (qmail 24919 invoked from network); 9 Mar 2006 21:58:02 -0000 Original-Received: from dsl093-011-017.cle1.dsl.speakeasy.net (HELO [192.168.0.27]) (gebser@[66.93.11.17]) (envelope-sender ) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 9 Mar 2006 21:58:02 -0000 User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en Original-To: Stefan Bienert In-Reply-To: <719707752@web.de> 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:33678 Archived-At: Stefan Bienert wrote: > Hi there, > > I have a problem with the adding of own types to the c-mode in emacs. I have used: > > (font-lock-add-keywords > 'c-mode > '(("\\<\\(Shortint\\)\\>" 1 font-lock-type-face t))) > > to make emacs highlighting the type "Shortint". But now its also highlighted in comments /* Shortint */. > What can I do to unhighlight it in comments? > >>From "C-h f font-lock-add-keywords": "For example: (font-lock-add-keywords 'c-mode '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend) ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face))) adds two fontification patterns for C mode, to fontify `FIXME:' words, even in comments, and to fontify `and', `or' and `not' words as keywords...." I'm no elisp programmer at all, but since no one else seems to know, I'm guessing that you need to employ the syntax in the third line of the example. As a sidenote though, I tried the snippet of code above, only changing "c-mode" to "html-helper-mode" and didn't get any highlighting at all (this in a buffer which has html tags already highlighted). The help page didn't say anything about bat wings or eye of newt, but I think you need those too. hth, ken -- "This world ain't big enough for the both of us," said the big noema to the little noema.