Function: tex-send-command
tex-send-command is a byte-compiled function defined in
tex-mode.el.gz.
Signature
(tex-send-command COMMAND &optional FILE BACKGROUND)
Documentation
Send COMMAND to TeX shell process, substituting optional FILE for *.
Do this in background if optional BACKGROUND is t. If COMMAND has no *, FILE will be appended, preceded by a blank, to COMMAND. If FILE is nil, no substitution will be made in COMMAND. COMMAND can be any expression that evaluates to a command string.
Return the process in which TeX is running.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex-send-command (command &optional file background)
"Send COMMAND to TeX shell process, substituting optional FILE for *.
Do this in background if optional BACKGROUND is t. If COMMAND has no *,
FILE will be appended, preceded by a blank, to COMMAND. If FILE is nil, no
substitution will be made in COMMAND. COMMAND can be any expression that
evaluates to a command string.
Return the process in which TeX is running."
(save-excursion
(let* ((cmd (eval command t))
(proc (tex-shell-proc))
(buf (process-buffer proc))
(star (string-search "*" cmd))
(string
(concat
(if (null file)
cmd
(if (file-name-absolute-p file)
(setq file (convert-standard-filename file)))
(if star (concat (substring cmd 0 star)
(shell-quote-argument file)
(substring cmd (1+ star)))
(concat cmd " " (shell-quote-argument file))))
(if background "&" ""))))
;; Switch to buffer before checking for subproc output in it.
(set-buffer buf)
;; If text is unchanged since previous tex-send-command,
;; we haven't got any output. So wait for output now.
(if (= (buffer-modified-tick buf) tex-send-command-modified-tick)
(accept-process-output proc))
(goto-char (process-mark proc))
(insert string)
(comint-send-input)
(setq tex-send-command-modified-tick (buffer-modified-tick buf))
proc)))