all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* custom C highlighting / syntax coloring
@ 2003-03-18 23:42 Chris Pickett
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Pickett @ 2003-03-18 23:42 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom C highlighting / syntax coloring
       [not found] <mailman.3348.1048030940.21513.help-gnu-emacs@gnu.org>
@ 2003-03-19 14:32 ` Javier Oviedo
  2003-03-19 14:58 ` Peter Boettcher
  1 sibling, 0 replies; 4+ messages in thread
From: Javier Oviedo @ 2003-03-19 14:32 UTC (permalink / raw)


I use ctypes.el

"Chris Pickett" <chris.pickett@mail.mcgill.ca> wrote in message
news:mailman.3348.1048030940.21513.help-gnu-emacs@gnu.org...
> 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.
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom C highlighting / syntax coloring
       [not found] <mailman.3348.1048030940.21513.help-gnu-emacs@gnu.org>
  2003-03-19 14:32 ` Javier Oviedo
@ 2003-03-19 14:58 ` Peter Boettcher
  2003-03-19 16:19   ` Matthew Kennedy
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Boettcher @ 2003-03-19 14:58 UTC (permalink / raw)



[CC to author]

Chris Pickett <chris.pickett@mail.mcgill.ca> writes:

> 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.

Try the package "ctypes.el".  It does exactly what you ask.  I found a
copy here:

http://www.emacswiki.org/elisp/ctypes.el


-- 
Peter Boettcher
MIT Lincoln Laboratory
boettcher@ll.mit.edu
(781) 981-5275

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom C highlighting / syntax coloring
  2003-03-19 14:58 ` Peter Boettcher
@ 2003-03-19 16:19   ` Matthew Kennedy
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Kennedy @ 2003-03-19 16:19 UTC (permalink / raw)


Peter Boettcher <boettcher@ll.mit.edu> writes:

> [CC to author]
> 
> Chris Pickett <chris.pickett@mail.mcgill.ca> writes:

> > 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
> 
> Try the package "ctypes.el".  It does exactly what you ask.  I found a
> copy here:
> 
> http://www.emacswiki.org/elisp/ctypes.el

I found a more recent version here:

	http://www.juliocastillo.com/emacs/site-lisp/ctypes.el

Matt

-- 
Matthew Kennedy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-19 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-18 23:42 custom C highlighting / syntax coloring Chris Pickett
     [not found] <mailman.3348.1048030940.21513.help-gnu-emacs@gnu.org>
2003-03-19 14:32 ` Javier Oviedo
2003-03-19 14:58 ` Peter Boettcher
2003-03-19 16:19   ` Matthew Kennedy

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.