Function: tex--redirect-to-submode

tex--redirect-to-submode is a byte-compiled function defined in tex-mode.el.gz.

Signature

(tex--redirect-to-submode ORIG-FUN)

Documentation

Redirect to one of the submodes when called directly.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex--redirect-to-submode (orig-fun)
  "Redirect to one of the submodes when called directly."
  ;; The file may have "mode: tex" in the local variable
  ;; block, in which case we'll be called recursively
  ;; infinitely.  Inhibit that.
  (let ((tex-mode--recursing tex-mode--recursing))
    (funcall (if (or delay-mode-hooks tex-mode--recursing)
                 ;; We're called from one of the children already.
                 orig-fun
               (setq tex-mode--recursing t)
               (let ((mode (tex--guess-mode)))
                 ;; `tex--guess-mode' really tries to guess the *type* of file,
                 ;; so we still need to consult `major-mode-remap-alist'
                 ;; to see which mode to use for that type.
                 (major-mode-remap mode))))))