Function: Texinfo-find-env-start
Texinfo-find-env-start is an interactive and byte-compiled function
defined in tex-info.el.
Signature
(Texinfo-find-env-start)
Documentation
Move point to the start of the current environment.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex-info.el
(defun Texinfo-find-env-start ()
"Move point to the start 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"))
(level 1)
(orig-pos (point))
case-fold-search)
(save-restriction
(save-excursion
(save-excursion
(beginning-of-line)
;; Stop if point is inside of an @<env> command, but not if
;; it is before it.
(when (and (looking-at regexp)
(not (match-string 2))
(< (match-beginning 1) orig-pos))
(setq level 0)))
(while (and (> level 0) (re-search-backward regexp nil t))
(if (match-string 2)
(setq level (1+ level))
(setq level (1- level)))))
(if (= level 0)
(goto-char (match-beginning 0))
(error "Can't locate start of current environment")))))