Function: TeX-arg-input-file

TeX-arg-input-file is a byte-compiled function defined in latex.el.

Signature

(TeX-arg-input-file OPTIONAL &optional PROMPT LOCAL)

Documentation

Prompt for a tex or sty file.

If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. PROMPT is the prompt, LOCAL is a flag. If the flag is set, only complete with local files.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun TeX-arg-input-file (optional &optional prompt local)
  "Prompt for a tex or sty file.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one.  PROMPT is the prompt,
LOCAL is a flag.  If the flag is set, only complete with local
files."
  (let ((search (if (eq TeX-arg-input-file-search 'ask)
                    (not (y-or-n-p "Find file yourself? "))
                  TeX-arg-input-file-search))
        file style)
    (if search
        (progn
          (unless (or TeX-global-input-files local)
            (message "Searching for files...")
            (setq TeX-global-input-files
                  (mapcar #'list (TeX-search-files-by-type
                                 'texinputs 'global t t)))
            (message "Searching for files...done"))
          (setq file (completing-read
                      (TeX-argument-prompt optional prompt "File")
                      (TeX-delete-dups-by-car
                       (append (mapcar #'list (TeX-search-files-by-type
                                              'texinputs 'local t t))
                               (unless local
                                 TeX-global-input-files))))
                style file))
      (setq file (read-file-name
                  (TeX-argument-prompt optional prompt "File") nil ""))
      (unless (string-equal file "")
        (setq file (file-relative-name file)))
      (setq style (file-name-sans-extension (file-name-nondirectory file))))
    (unless (string-equal "" style)
      (TeX-run-style-hooks style))
    (TeX-argument-insert file optional)))