CC Mode contains some useful commands for moving around in C code.
c-beginning-of-defun)c-end-of-defun)The start of a function is at its header. The end of the function is
after its closing brace, or after the semicolon of a construct (such
as a struct) which doesn't end at the brace. These two
commands try to leave point at the beginning of a line near the actual
start or end of the function. This occasionally causes point not to
move at all.
These functions are analogous to the Emacs built-in commands
beginning-of-defun and end-of-defun, except they
eliminate the constraint that the top-level opening brace of the defun
must be in column zero. See Defuns (GNU Emacs Manual), for more information.
c-awk-beginning-of-defun)c-awk-end-of-defun)beginning-of-defun and end-of-defun.
AWK Mode defuns are either pattern/action pairs (either of which
might be implicit) or user defined functions. Having the { and
} (if there are any) in column zero, as is suggested for some
modes, is neither necessary nor helpful in AWK mode.
c-beginning-of-statement)c-end-of-statement)If point is within or next to a comment or a string which spans more than one line, these commands move by sentences instead of statements.
When called from a program, these functions take three optional
arguments: the repetition count, a buffer position limit which is the
farthest back to search for the syntactic context, and a flag saying
whether to do sentence motion in or near comments and multiline
strings.
c-up-conditional)#elif is treated like #else followed by #if, so the function stops at them when going backward, but not when going forward.
This key sequence is not bound in AWK Mode, which doesn't have
preprocessor statements.
c-up-conditional that also stops at #else
lines. Normally those lines are ignored.
#elif is treated like #else followed by #if, so the
function stops at them when going forward, but not when going backward.
c-down-conditional that also stops at #else
lines. Normally those lines are ignored.
c-backward-conditional)c-forward-conditional)These key sequences are not bound in AWK Mode, which doesn't have
preprocessor statements.
These commands move backward or forward to the beginning of the next capitalized word. With prefix argument n, move n times. If n is negative, move in the opposite direction.
Note that these two commands have been superseded by
c-subword-mode, which you should use instead. See Subword Movement. They might be removed from a future release of CC Mode.