From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stuart D. Herring" Newsgroups: gmane.emacs.devel,gmane.comp.programming.tools.cmake.user Subject: Re: cmake emacs mode Date: Wed, 26 Apr 2006 08:17:39 -0700 (PDT) Message-ID: <56450.128.165.123.132.1146064659.squirrel@webmail.lanl.gov> References: <6.2.0.14.2.20060425222650.08bc97d0@pop.biz.rr.com> Reply-To: herring@lanl.gov NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1146064766 21160 80.91.229.2 (26 Apr 2006 15:19:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2006 15:19:26 +0000 (UTC) Cc: cmake@cmake.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 26 17:19:19 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FYlmJ-00024W-PU for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 17:18:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYlmI-00042r-S0 for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 11:18:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYlm3-00040e-G2 for emacs-devel@gnu.org; Wed, 26 Apr 2006 11:17:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYlm1-0003xh-00 for emacs-devel@gnu.org; Wed, 26 Apr 2006 11:17:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYlm0-0003xW-SK for emacs-devel@gnu.org; Wed, 26 Apr 2006 11:17:48 -0400 Original-Received: from [192.65.95.54] (helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FYloi-0003sA-L8 for emacs-devel@gnu.org; Wed, 26 Apr 2006 11:20:37 -0400 Original-Received: from mailrelay3.lanl.gov (mailrelay3.lanl.gov [128.165.4.104]) by mailwasher-b.lanl.gov (8.12.11.20060308/8.12.11/(ccn-5)) with ESMTP id k3QFHicF023863 for ; Wed, 26 Apr 2006 09:17:44 -0600 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay3.lanl.gov (8.12.11.20060308/8.12.11/(ccn-5)) with ESMTP id k3QFHdmw008532; Wed, 26 Apr 2006 09:17:39 -0600 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id k3QFHdVm032446; Wed, 26 Apr 2006 09:17:39 -0600 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id k3QFHdW5032444; Wed, 26 Apr 2006 08:17:39 -0700 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.132 (SquirrelMail authenticated user 196434); by webmail.lanl.gov with HTTP; Wed, 26 Apr 2006 08:17:39 -0700 (PDT) In-Reply-To: <6.2.0.14.2.20060425222650.08bc97d0@pop.biz.rr.com> Original-To: "William A. Hoffman" User-Agent: SquirrelMail/1.4.3a-11.EL3 X-Mailer: SquirrelMail/1.4.3a-11.EL3 X-Priority: 3 (Normal) Importance: Normal X-PMX-Version: 4.7.1.128075 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53480 gmane.comp.programming.tools.cmake.user:1127 Archived-At: > ; TODO: If anyone knows how to match function names occurring before an > ; open-paren and highlight them without also highlighting the > ; open-paren, please contact cmake@cmake.org or kitware@kitware.com > ; and tell us how to do it. We would rather not have to include the > ; entire list of CMake commands in this mode file, which is a pain to > ; maintain. Thanks. There's several things here. First, there's no reason you have to go through the *scratch* nonsense. Just put the big commented-out `regexp-opt' call into the `defvar': (defconst cmake-font-lock-defaults (list (cons (regexp-opt '("foo" "bar") 'words) 'font-lock-function-name-face)) "Highlighting expressions for CMAKE mode.") You then don't have to have the 3k output in the file, just the code in the comment. I also note that there's a syntax error that makes the doc string actually be a part of the (list) form. If you want to not force the load of regexp-opt, you can use `eval-when-compile'; see regexp-opt.el for info. Moreover, later you do (setq font-lock-defaults '(cmake-font-lock-defaults)) ...which suggests to me that the variable should in fact be called `cmake-font-lock-keywords' or so, not `...-defaults'. Now, if you'd really rather get rid of the list altogether, as the comment suggests, then you can use this as an element of the keywords list: ("\\(\\w+\\)(" 1 font-lock-function-name-face) The trick is that the 1 says to highlight the first captured expression, rather than the whole match, and the group doesn't contain the `('. Moreover, this mode (aside from the indenting) looks to be extremely simple; you might be able to get away with making it a derived major mode (from Fundamental mode, probably; see `define-derived-mode') or even a generic mode (see `define-generic-mode'). Might make it less trouble to keep up with. Hope it helps, Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.