(emacs)C Mode

Next: Fortran Prev: Emerge Up: Programs

C Mode

   In addition to the facilities of typical programming language major
modes (Note: Program Modes.), C mode has various special facilities.

     In C mode, `M-a' and `M-e' now move by complete C statements
     (`c-beginning-of-statement' and `c-end-of-statement').  These
     commands do ordinary, textual sentence motion when in or next to a

     `M-q' in C mode runs `c-fill-paragraph', which is designed for
     filling C comments.  (We assume you don't want to fill the actual
     C code in a C program.)

`C-c C-u'
     Move back to the containing preprocessor conditional, setting the
     mark at the starting point (`c-up-conditional').

     A prefix argument acts as a repeat count.  With a negative
     argument, this command moves forward to the end of the containing
     preprocessor conditional.  When going backwards, `#elif' acts like
     `#else' followed by `#if'.  When going forwards, `#elif' is

`C-c C-n'
     Move forward across the next preprocessor conditional, setting the
     mark at the starting point (`c-forward-conditional').

`C-c C-p'
     Move backward across the previous preprocessor conditional,
     setting the at the starting point (`c-backward-conditional').

`M-x c-macro-expand'
     When you are debugging C code that uses macros, sometimes it is
     hard to figure out precisely how the macros expand.  The command
     `M-x c-macro-expand' runs the C preprocessor and shows you what
     expansion results from the region.  The portion of the buffer
     before the region is also included in preprocessing, for the sake
     of macros defined there, but the output from this part isn't shown.

`M-x c-backslash-region'
     Insert or align `\' characters at the ends of the lines of the
     region, except for the last such line.  This is useful after
     writing or editing a C macro definition.

     If a line already ends in `\', this command adjusts the amount of
     whitespace before it.  Otherwise, it inserts a new `\'.

   C++ mode is like C mode, except that it understands C++ comment
syntax and certain other differences between C and C++.  It also has a
command `M-x fill-c++-comment', which fills a paragraph made of C++
comment lines.

   The command `comment-region' is useful in C++ mode for commenting
out several consecutive lines, or removing the commenting out of such
lines.  (You don't need this command with C comment syntax because you
don't need to put comment delimiters on each line.)  Note: Comments.

automatically generated by info2www