Function: Texinfo-find-env-end
Texinfo-find-env-end is an interactive and byte-compiled function
defined in tex-info.el.
Signature
(Texinfo-find-env-end)
Documentation
Move point to the end of the current environment.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex-info.el
(defun Texinfo-find-env-end ()
"Move point to the end of the current environment."
(interactive)
(let* ((envs (mapcar #'car Texinfo-environment-list))
(regexp (concat "^[ \t]*" (regexp-quote TeX-esc) "\\(end \\)*"
(regexp-opt envs t) "\\b"))
(orig-pos (point))
(level 1)
case-fold-search)
(save-restriction
(save-excursion
(save-excursion
(beginning-of-line)
;; Stop if point is inside of an @end <env> command, but not
;; if it is behind it.
(when (and (looking-at regexp)
(match-string 1)
(> (match-end 0) orig-pos))
(setq level 0)))
(while (and (> level 0) (re-search-forward regexp nil t))
(if (match-string 1)
(setq level (1- level))
(setq level (1+ level)))))
(if (= level 0)
(goto-char (match-end 0))
(error "Can't locate end of current environment")))))