Function: TeX-find-balanced-brace

TeX-find-balanced-brace is a byte-compiled function defined in tex.el.

Signature

(TeX-find-balanced-brace &optional COUNT DEPTH LIMIT)

Documentation

Return the position of a balanced brace in a TeX group.

The function scans forward COUNT parenthetical groupings. Default is 1. If COUNT is negative, it searches backwards. With optional DEPTH>=1, find that outer level. If LIMIT is non-nil, do not search further than this position in the buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-find-balanced-brace (&optional count depth limit)
  "Return the position of a balanced brace in a TeX group.
The function scans forward COUNT parenthetical groupings.
Default is 1.  If COUNT is negative, it searches backwards.  With
optional DEPTH>=1, find that outer level.  If LIMIT is non-nil,
do not search further than this position in the buffer."
  (let ((count (if count
                   (if (= count 0) (error "COUNT has to be <> 0") count)
                 1))
        (depth (if depth
                   (if (< depth 1) (error "DEPTH has to be > 0") depth)
                 1)))
    (save-restriction
      (when limit
        (if (> count 0)
            (narrow-to-region (point-min) limit)
          (narrow-to-region limit (point-max))))
      (with-syntax-table (TeX-search-syntax-table ?\{ ?\})
        (condition-case nil
            (scan-lists (point) count depth)
          (error nil))))))