I am using emacs to write c++ code. How to configure it to let the system highlight C++ keywords, variables, etc; and let it automatically indent, just like a common C++ IDE does?
Any suggestions? Thanks!
I am using emacs to write c++ code. How to configure it to let the system highlight C++ keywords, variables, etc; and let it automatically indent, just like a common C++ IDE does?
Any suggestions? Thanks!
Last edited by meili100; 06-15-2007 at 09:28 AM.
You want to turn on global font lock for highlighting. You can do this by hand by typing "meta-x" (usually "alt-x"), then start typing global-font-lock and use the tab completion to get the name right.
If you want it on by default add the appropriate line to your .emacs file... look here
http://www.google.com/search?q=globa...-US:unofficial
If the file extension is .c or .cpp you'll get proper indentation just by push tab anywhere on a line. To (re)indent an entire file, select all ("ctrl-x h") then run indent region (not sure if there's a default binding for this, just use "meta-x indent-region").
Go on the menu bar to Options > Customize Emacs and explore, and you'll find lots of simple ways to make customizations. Don't ask me what the difference between 'options' and 'settings' are, though.
If you're using XEmacs, you're in luck, possibly -- in my experience it is much easier to customize.
There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.