Function: ConTeXt-find-matching-stop

ConTeXt-find-matching-stop is an interactive and byte-compiled function defined in context.el.

Signature

(ConTeXt-find-matching-stop &optional INNER)

Documentation

Find end of current \start...\stop-Pair.

If INNER is non-nil, go to the point just past before
\stop... macro. Otherwise goto the point just past \stop...

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/context.el
(defun ConTeXt-find-matching-stop (&optional inner)
  "Find end of current \\start...\\stop-Pair.
If INNER is non-nil, go to the point just past before
\\stop... macro.  Otherwise goto the point just past \\stop..."
  (interactive)
  (let ((regexp (concat (regexp-quote TeX-esc)
                        "\\("
                        (ConTeXt-environment-start-name)
                        "\\|"
                        (ConTeXt-environment-stop-name)
                        "\\)"
                        ))
        (level 1))
    ;;jump over the \start... when at the beginning of it.
    (when (looking-at (concat (regexp-quote TeX-esc)
                              (ConTeXt-environment-start-name)))
      (re-search-forward regexp nil t))
    (while (and (> level 0)
                (re-search-forward regexp nil t)
                (goto-char (1- (match-beginning 1)))
                (cond ((looking-at (concat (regexp-quote TeX-esc)
                                           (ConTeXt-environment-start-name)))
                       (re-search-forward regexp nil t)
                       (setq level (1+ level)))
                      ((looking-at (concat (regexp-quote TeX-esc)
                                           (ConTeXt-environment-stop-name)))
                       (re-search-forward regexp nil t)
                       (setq level (1- level))))))
    ;; now we have to look if we want to start behind the \start... macro
    (if inner
        (beginning-of-line)
      (skip-chars-forward "a-zA-Z"))))