Function: forward-sexp
forward-sexp is an interactive and byte-compiled function defined in
lisp.el.gz.
Signature
(forward-sexp &optional ARG INTERACTIVE)
Documentation
Move forward across one balanced expression (sexp).
With ARG, do it that many times. Negative arg -N means move
backward across N balanced expressions. This command assumes
point is not in a string or comment. Calls
forward-sexp-function to do the work, if that is non-nil.
If unable to move over a sexp, signal scan-error with three
arguments: a message, the start of the obstacle (usually a
parenthesis or list marker of some kind), and end of the
obstacle. If INTERACTIVE is non-nil, as it is interactively,
report errors as appropriate for this kind of usage.
Probably introduced at or before Emacs version 21.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp.el.gz
(defun forward-sexp (&optional arg interactive)
"Move forward across one balanced expression (sexp).
With ARG, do it that many times. Negative arg -N means move
backward across N balanced expressions. This command assumes
point is not in a string or comment. Calls
`forward-sexp-function' to do the work, if that is non-nil.
If unable to move over a sexp, signal `scan-error' with three
arguments: a message, the start of the obstacle (usually a
parenthesis or list marker of some kind), and end of the
obstacle. If INTERACTIVE is non-nil, as it is interactively,
report errors as appropriate for this kind of usage."
(interactive "^p\nd")
(if interactive
(condition-case _
(forward-sexp arg nil)
(scan-error (user-error (if (> arg 0)
"No next sexp"
"No previous sexp"))))
(or arg (setq arg 1))
(if forward-sexp-function
(funcall forward-sexp-function arg)
(forward-sexp-default-function arg))))