From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Chris Pickett Newsgroups: gmane.emacs.help Subject: custom C highlighting / syntax coloring Date: Tue, 18 Mar 2003 18:42:32 -0500 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3E77AEE8.2070101@mail.mcgill.ca> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1048031047 25967 80.91.224.249 (18 Mar 2003 23:44:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 18 Mar 2003 23:44:07 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 19 00:44:06 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18vQkX-0006kh-00 for ; Wed, 19 Mar 2003 00:44:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vQj8-00005x-03 for gnu-help-gnu-emacs@m.gmane.org; Tue, 18 Mar 2003 18:42:38 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18vQie-0007yf-00 for help-gnu-emacs@gnu.org; Tue, 18 Mar 2003 18:42:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18vQiZ-0007oI-00 for help-gnu-emacs@gnu.org; Tue, 18 Mar 2003 18:42:06 -0500 Original-Received: from tomts20.bellnexxia.net ([209.226.175.74] helo=tomts20-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vQiZ-0007n4-00 for help-gnu-emacs@gnu.org; Tue, 18 Mar 2003 18:42:03 -0500 Original-Received: from mail.mcgill.ca ([65.94.119.31]) by tomts20-srv.bellnexxia.netESMTP <20030318234159.TBFV13816.tomts20-srv.bellnexxia.net@mail.mcgill.ca> for ; Tue, 18 Mar 2003 18:41:59 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1; MultiZilla v1.1.32 final) Gecko/20030312 X-Accept-Language: en-ca, en-us, ja Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7697 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7697 Hi, I like how CC Mode (for a .c or .h file) automatically recognizes words ending in '_t' as being types and highlights them and the corresponding declarations. However, I am working on a large project with several other types. I need help customizing emacs to recognize these other patterns as types. I find it makes understanding the source, which I did not write, a lot easier. There are two classes: 1) most of the project-specific types start with '_svmt_' and so I would like to recognize all of those, and have emacs color them. 2) several specific words such are also types, such as 'jboolean', 'jint', 'jfloat', 'jobject', 'JNIEnv'. There's probably about 20 or so. These are static and unlikely to change as the project changes ... they are defined by the Java Native Interface specification. I managed to append '_t' to all words starting with '_svmt_', but the other developers don't like that solution. It also doesn't solve the problem for the second class of types. I looked at the CC Mode source, and I suppose I could define a whole bunch more primitive types (solving problem number two), but I don't know how to set that in my .emacs file. Finally, although this isn't really needed, it would be neat if the highlighting worked only in certain directories. Maybe my .emacs file could be modified to check for the presence of another highlighting file in whatever directory emacs is currently in, and if found change the C sub-mode (?) of CC Mode to recognize my extra types. Oh ... I'm using emacs 21.2.1, on 'woody' debian gnu/linux. Thanks very much, Chris Pickett P.S. Please include my email address in the reply as I have not subscribed to this list. P.P.S. I looked through the list archives and did about 1-2 hours of searching / reading on Google, but still could not find anyone who had tried to do this.