Function: bib-master-file

bib-master-file is a byte-compiled function defined in bib-cite.el.

Signature

(bib-master-file)

Documentation

Return master file full path, or nil if not a multi-file document.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/bib-cite.el
(defun bib-master-file ()
  "Return master file full path, or nil if not a multi-file document."
;; I wish there were a better way to tell about non multi-file documents...
  (let ((master
         (cond
          ((not (boundp 'TeX-master))
           ;; This buffer doesn't know what a master file is, so return now.
           nil)
          ((and TeX-master              ;Set, but not to t
                (not (symbolp TeX-master))) ; then we have an actual name
           (expand-file-name TeX-master))
          ((and (eq TeX-master 't)      ;Test if master file itself
                (progn                  ;But also require at least one \include
                  (save-excursion
                    (goto-char 1)       ;Too bad I have to do this search...
                    ;; Require that user uses \input{file}
                    ;; rather than            \input file
                    (re-search-forward "^[ \t]*\\\\\\(include\\|input\\){"
                                       nil t))))
           (TeX-buffer-file-name))
          (t
           nil))))
    (cond
     ((not master)
      nil)
     ((string-match ".\\(tex\\|ltx\\)$" master)
      master)
     ((file-readable-p (concat master ".ltx"))
      (concat master ".ltx"))
     (t
      (concat master ".tex")))))