next up previous contents index
Next: Scheme Mode Up: Programming Modes Previous: Programming Modes

C Mode

If you use Emacs for programming in the C language , you can get it to do all the indentation for you automatically. Files whose names end in ``.c '' or ``.h'' are automatically brought up in c-mode. This means that certain special editing commands, useful for writing C-programs, are available. In C-mode, tex2html_wrap8288 is bound to c-indent-command. This means that hitting the tex2html_wrap8288 key does not actually insert a tab character. Instead, if you hit tex2html_wrap8288 anywhere on a line, Emacs automatically indents that line correctly for its location in the program. This implies that Emacs knows something about C syntax, which it does (although nothing about semantics--it cannot insure that your program has no errors!)

In order to do this, it assumes that the previous lines are indented correctly. That means that if the preceding line is missing a parenthesis, semicolon, curly brace, or whatever, Emacs will indent the current line in a funny way. When you see it do that, you will know to look for a punctuation mistake on the line above.

You can use this feature to check that you have punctuated your programs correctly--instead of reading through the entire program looking for problems, just start indenting lines from the top down with tex2html_wrap8288 , and when something indents oddly, check the lines just before it. In other words, let Emacs do the work for you!



Converted on:
Mon Apr 1 08:59:56 EST 1996