Function: TeX-command-default

TeX-command-default is a byte-compiled function defined in tex.el.

Signature

(TeX-command-default NAME-OR-FILE-FN)

Documentation

Guess the next command to be run on NAME-OR-FILE-FN.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-command-default (name-or-file-fn)
  "Guess the next command to be run on NAME-OR-FILE-FN."
  (let ((command-next nil)
        (name (TeX--concat-ext name-or-file-fn)))
    (cond ((if (eq name-or-file-fn #'TeX-region-file)
               (TeX-check-files (TeX-region-file (TeX-output-extension))
                                ;; Each original will be checked for all dirs
                                ;; in `TeX-check-path' so this needs to be just
                                ;; a filename without directory.
                                (list (file-relative-name name))
                                TeX-file-extensions)
             (TeX-save-document name-or-file-fn))
           TeX-command-default)
          ((and (memq major-mode '(docTeX-mode LaTeX-mode))
                ;; Want to know if bib file is newer than .bbl
                ;; We don't care whether the bib files are open in emacs
                (TeX-check-files (TeX--concat-ext name-or-file-fn "bbl")
                                 (mapcar #'car
                                         (LaTeX-bibliography-list))
                                 (append BibTeX-file-extensions
                                         TeX-Biber-file-extensions)))
           ;; We should check for bst files here as well.
           (if (bound-and-true-p LaTeX-using-Biber)
               TeX-command-Biber TeX-command-BibTeX))
          ((and
            ;; Rationale: makeindex should be run when final document is almost
            ;; complete (see
            ;; https://tex-talk.net/2012/09/dont-forget-to-run-makeindex/),
            ;; otherwise, after following latex runs, index pages may change due
            ;; to changes in final document, resulting in extra makeindex and
            ;; latex runs.
            (member
             (setq command-next
                   (TeX-process-get-variable
                    name
                    'TeX-command-next
                    (or (and TeX-PDF-mode (TeX-PDF-from-DVI))
                        TeX-command-Show)))
             (list "Dvips" "Dvipdfmx" TeX-command-Show))
            (cdr (assoc (expand-file-name (TeX--concat-ext name-or-file-fn "idx"))
                        LaTeX-idx-changed-alist)))
           "Index")
          (command-next)
          (TeX-command-Show))))