Function: TeX-view-command-raw
TeX-view-command-raw is a byte-compiled function defined in tex.el.
Signature
(TeX-view-command-raw)
Documentation
Choose a viewer and return its unexpanded command string.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-view-command-raw ()
"Choose a viewer and return its unexpanded command string."
(let ((selection TeX-view-program-selection)
entry viewer item executable spec command)
;; Find the appropriate viewer.
(while (and (setq entry (pop selection)) (not viewer))
(when (TeX-view-match-predicate (car entry))
(setq viewer (cadr entry))))
(unless viewer
(error "No matching viewer found"))
(setq item (assoc viewer (append TeX-view-program-list
TeX-view-program-list-builtin))
;; Get the command line or function spec.
spec (cadr item)
;; Get the name of the executable(s) associated to the viewer.
executable (nth 2 item))
;; Check the executable exists.
(unless (or (null executable)
(cond
((stringp executable)
(executable-find (TeX-command-expand executable)))
((listp executable)
(catch 'notfound
(dolist (exec executable t)
(unless (executable-find (TeX-command-expand exec))
(throw 'notfound nil)))))))
(error (format "Cannot find %S viewer. \
Select another one in `TeX-view-program-selection'" viewer)))
(cond ((functionp spec)
;; Converting the function call to a string is ugly, but
;; the backend currently only supports strings.
(prin1-to-string spec))
((stringp spec)
spec)
((null spec)
(error
(format "Unknown %S viewer. \
Check the `TeX-view-program-selection' variable" viewer)))
(t
;; Build the unexpanded command line. Pieces with predicates are
;; only added if the predicate is evaluated positively.
(dolist (elt spec)
(cond ((stringp elt)
(setq command (concat command elt)))
((listp elt)
(when (TeX-view-match-predicate (car elt))
(setq command (concat command (cadr elt)))))))
(if (stringp command)
command
;; Signal an error if `command' isn't a string. This prevents an
;; infinite loop in `TeX-command-expand' if `command' is nil.
(error "Wrong viewer specification in `TeX-view-program-list'"))))))