Function: tex-expl-region-set

tex-expl-region-set is a byte-compiled function defined in tex-mode.el.gz.

Signature

(tex-expl-region-set BEG END)

Documentation

Create a list of regions where expl3 syntax is active.

This function updates the list whenever syntax-propertize runs, and stores it in the buffer-local variable tex-expl-region-list. The list will always be nil when the buffer visits an expl3 file, for example, an expl3 class or package, where the entire file uses expl3 syntax.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex-expl-region-set (_beg _end)
  "Create a list of regions where expl3 syntax is active.
This function updates the list whenever `syntax-propertize' runs, and
stores it in the buffer-local variable `tex-expl-region-list'.  The list
will always be nil when the buffer visits an expl3 file, for example, an
expl3 class or package, where the entire file uses expl3 syntax."
  (unless syntax-ppss--updated-cache;; Stop forward search running twice.
    (setq tex-expl-region-list nil)
    ;; Leaving this test here allows users to set `tex-expl-buffer-p'
    ;; independently of the mode's automatic detection of an expl3 file.
    (unless tex-expl-buffer-p
      (goto-char (point-min))
      (let ((case-fold-search nil))
        (while (tex-search-noncomment
                (search-forward "\\ExplSyntaxOn" nil t))
          (let ((new-beg (point))
                (new-end (or (tex-search-noncomment
                              (search-forward "\\ExplSyntaxOff" nil t))
                             (point-max))))
            (push (cons new-beg new-end) tex-expl-region-list)))))))