Function: LaTeX-find-matching-begin

LaTeX-find-matching-begin is an interactive and byte-compiled function defined in latex.el.

Signature

(LaTeX-find-matching-begin)

Documentation

Move point to the \begin of the current environment.

If function is called inside a comment and LaTeX-syntactic-comments is enabled, try to find the environment in commented regions with the same comment prefix.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-find-matching-begin ()
  "Move point to the \\begin of the current environment.

If function is called inside a comment and
`LaTeX-syntactic-comments' is enabled, try to find the
environment in commented regions with the same comment prefix."
  (declare (modes LaTeX-mode))
  (interactive)
  (let (done)
    ;; The following code until `or' handles exceptional cases that
    ;; the point is on "\begin{foo}" or "\end{foo}".
    ;; Note that it doesn't work for "\end{\foo{bar}}". See bug#19281.
    (skip-chars-backward (concat "a-zA-Z* \t" TeX-grop))
    (unless (bolp)
      (backward-char 1)
      (and (looking-at (concat (regexp-quote TeX-esc) "begin\\b"))
           (setq done t)))
    (or done
        (LaTeX-backward-up-environment)
        (error "Can't locate beginning of current environment"))))