Where I work we use a lot of our own custom data types. The c++ that emacs recognizes, notices many of the custom datatypes from the STL such as string, vector, etc. This means that in my editor if i declare a function like so:
string getString() const {
return str;
}
The return value will be highlighted green and due to this the function name will in blue. Now if I decide to use a custom string this messes everything up. So now my cpp files are mostly in white because we don’t use the normal stl classes here. How can I program my emacs editor to recognize that when I mean ‘String’, color it the same way you would as ‘string’?
You need
font-lock-add-keywords. Here’s an example:It adds a list of regular expression/font lock pairs.
There’s much more to be read on the topic of adding-keywords.
In particular, ctypes.el might be of interest to you.