Function: tex-env-mark

tex-env-mark is a byte-compiled function defined in tex-mode.el.gz.

Signature

(tex-env-mark CMD START END)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex-env-mark (cmd start end)
  (when (= cmd (line-beginning-position))
    (let ((arg (buffer-substring-no-properties (1+ start) (1- end))))
      (when (member arg tex-verbatim-environments)
        (if (eq ?b (char-after (1+ cmd)))
            ;; \begin
            (put-text-property (line-end-position)
                               (line-beginning-position 2)
                               'syntax-table (string-to-syntax "< c"))
          ;; In the case of an empty verbatim env, the \n after the \begin is
          ;; the same as the \n before the \end.  Lucky for us, the "> c"
          ;; property associated to the \end will be placed afterwards, so it
          ;; will override the "< c".
          (put-text-property (1- cmd) cmd
                             'syntax-table (string-to-syntax "> c"))
          ;; The text between \end{verbatim} and \n is ignored, so we'll treat
          ;; it as a comment.
          (put-text-property end (min (1+ end) (line-end-position))
                             'syntax-table (string-to-syntax "<"))))))
  ;; Mark env args for possible electric pairing.
  (unless (get-char-property (1+ start) 'text-clones) ;Already paired-up.
    (put-text-property start end 'latex-env-pair t)))