Function: scan-lists

scan-lists is a function defined in syntax.c.

Signature

(scan-lists FROM COUNT DEPTH)

Documentation

Scan from character number FROM by COUNT lists.

Scan forward if COUNT is positive, backward if COUNT is negative. Return the character number of the position thus found.

A "list", in this context, refers to a balanced parenthetical grouping, as determined by the syntax table.

If DEPTH is nonzero, treat that as the nesting depth of the starting point (i.e. the starting point is DEPTH parentheses deep). This function scans over parentheses until the depth goes to zero COUNT times. Hence, positive DEPTH moves out that number of levels of parentheses, while negative DEPTH moves to a deeper level.

Comments are ignored if parse-sexp-ignore-comments is non-nil.

If we reach the beginning or end of the accessible part of the buffer before we have scanned over COUNT lists, return nil if the depth at that point is zero, and signal an error if the depth is nonzero.

Source Code

// Defined in /usr/src/emacs/src/syntax.c
{
  CHECK_FIXNUM (from);
  CHECK_FIXNUM (count);
  CHECK_FIXNUM (depth);

  return scan_lists (XFIXNUM (from), XFIXNUM (count), XFIXNUM (depth), 0);
}