[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
31.11.1 C Mode Motion Commands
This section describes commands for moving point, in C mode and related modes.
-
M-x c-beginning-of-defun
-
M-x c-end-of-defun
-
Move point to the beginning or end of the current function or top-level definition. These are found by searching for the least enclosing braces. (By contrast,
beginning-of-defun
andend-of-defun
search for braces in column zero.) If you are editing code where the opening brace of a function isn't placed in column zero, you may wish to bindC-M-a
andC-M-e
to these commands. See section Moving by Defuns. -
C-c C-u
-
Move point back to the containing preprocessor conditional, leaving the mark behind. A prefix argument acts as a repeat count. With a negative argument, move point forward to the end of the containing preprocessor conditional.
‘#elif’ is equivalent to ‘#else’ followed by ‘#if’, so the function will stop at a ‘#elif’ when going backward, but not when going forward.
-
C-c C-p
-
Move point back over a preprocessor conditional, leaving the mark behind. A prefix argument acts as a repeat count. With a negative argument, move forward.
-
C-c C-n
-
Move point forward across a preprocessor conditional, leaving the mark behind. A prefix argument acts as a repeat count. With a negative argument, move backward.
-
M-a
-
Move point to the beginning of the innermost C statement (
c-beginning-of-statement
). If point is already at the beginning of a statement, move to the beginning of the preceding statement. With prefix argument n, move back n - 1 statements.In comments or in strings which span more than one line, this command moves by sentences instead of statements.
-
M-e
-
Move point to the end of the innermost C statement or sentence; like M-a except that it moves in the other direction (
c-end-of-statement
).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |