Function: tex-compile
tex-compile is an interactive and byte-compiled function defined in
tex-mode.el.gz.
Signature
(tex-compile DIR CMD)
Documentation
Run a command CMD on current TeX buffer's file in DIR.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex-compile (dir cmd)
"Run a command CMD on current TeX buffer's file in DIR."
;; FIXME: Use time-stamps on files to decide the next op.
(interactive
(let* ((file (tex-main-file))
(default-directory
(prog1 (file-name-directory (expand-file-name file))
(setq file (file-name-nondirectory file))))
(root (file-name-sans-extension file))
(fspec (list (cons ?r root)
(cons ?f file)))
(default (tex-compile-default fspec)))
(list default-directory
(completing-read
(format-prompt "Command" (tex-summarize-command default))
(mapcar (lambda (x)
(list (tex-format-cmd (eval (car x) t) fspec)))
tex-compile-commands)
nil nil nil 'tex-compile-history default))))
(save-some-buffers (not compilation-ask-about-save) nil)
(let ((f (and (string-match "^\\\\\\([^ \t\n]+\\)" cmd)
(intern-soft (concat "tex-cmd-" (match-string 1 cmd))))))
(if (functionp f)
(condition-case nil
(let ((default-directory dir))
(apply f (split-string-and-unquote
(substring cmd (match-end 0)))))
(wrong-number-of-arguments
(error "Wrong number of arguments to %s"
(substring (symbol-name f) 8))))
(if (tex-shell-running)
(tex-kill-job)
(tex-start-shell))
(setq tex-print-file (expand-file-name (tex-main-file)))
(tex-send-tex-command cmd dir))))