The Emacs commands for handling parenthetical groupings see nothing except parentheses (or whatever characters must balance in the language you are working with). They ignore strings and comments (including any parentheses within them) and ignore parentheses quoted by an escape character. They are mainly intended for editing programs, but can be useful for editing any text that has parentheses. They are sometimes called “list” commands because in Lisp these groupings are lists.
These commands assume that the starting point is not inside a string or a comment. Sometimes you can invoke them usefully from one of these places (for example, when you have a parenthesised clause in a comment) but this is unreliable.
The “list” commands C-M-n (
backward-list) move forward or backward over one
(or n) parenthetical groupings.
C-M-n and C-M-p try to stay at the same level in the
parenthesis structure. To move up one (or n) levels, use
backward-up-list). C-M-u moves backward up
past one unmatched opening delimiter. A positive argument serves as a
repeat count; a negative argument reverses the direction of motion, so
that the command moves forward and up one or more levels.
To move down in the parenthesis structure, use C-M-d
down-list). In Lisp mode, where ‘(’ is the only opening
delimiter, this is nearly the same as searching for a ‘(’. An
argument specifies the number of levels to go down.