Function: TeX-check-engine

TeX-check-engine is a byte-compiled function defined in tex.el.

Signature

(TeX-check-engine NAME)

Documentation

Check the correct engine has been set.

Look into TeX-check-engine-list for the required engines.

NAME is the command to be run. Actually do the check only if the variable TeX-check-engine(var)/TeX-check-engine(fun) is non-nil and LaTeX is the command to be run.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-check-engine (name)
  "Check the correct engine has been set.

Look into `TeX-check-engine-list' for the required engines.

NAME is the command to be run.  Actually do the check only if the
variable `TeX-check-engine' is non-nil and LaTeX is the command
to be run."
  (and
   (string= name "LaTeX")
   TeX-check-engine
   TeX-check-engine-list
   (null (memq TeX-engine TeX-check-engine-list))
   (memq TeX-engine '(default luatex omega xetex))
   ;; The set engine is not listed in `TeX-check-engine-list'.  We check only
   ;; builtin engines because we can't take care of custom ones.  Do nothing if
   ;; there is no allowed engine, we don't know what to do in that case.
   (let ((length (length TeX-check-engine-list))
         (name-alist '((default . "TeX")
                       (luatex  . "LuaTeX")
                       (omega   . "Omega")
                       (xetex   . "XeTeX")))
         (completion-ignore-case t)
         (engine nil))
     (when
         (cond
          ;; There is exactly one allowed engine.
          ((= length 1)
           (setq engine (car TeX-check-engine-list))
           (y-or-n-p (format "%s is required to build this document.
Do you want to use this engine? " (cdr (assoc engine name-alist)))))
          ;; More than one engine is allowed.
          ((> length 1)
           (if (y-or-n-p (format "It appears %s are required to build this document.
Do you want to select one of these engines? "
                                 (mapconcat
                                  (lambda (elt) (cdr (assoc elt name-alist)))
                                  TeX-check-engine-list ", ")))
               (setq engine
                     (car (rassoc
                           (completing-read
                            (format
                             "Choose between %s: "
                             (mapconcat
                              (lambda (elt) (cdr (assoc elt name-alist)))
                              TeX-check-engine-list ", "))
                            (mapcar
                             (lambda (elt) (cdr (assoc elt name-alist)))
                             TeX-check-engine-list))
                           name-alist)))
             ;; Don't keep asking.  If user doesn't want to change engine,
             ;; probably has a good reason.  In order to do so, without adding
             ;; yet another variable we just hack `TeX-check-engine-list' and
             ;; make it nil.
             (setq TeX-check-engine-list nil))))
       (TeX-engine-set engine)
       (when (y-or-n-p "Do you want to remember the choice? ")
         (add-file-local-variable 'TeX-engine engine)
         (save-buffer))))))