Function: tex-append
tex-append is a byte-compiled function defined in tex-mode.el.gz.
Signature
(tex-append FILE-NAME SUFFIX)
Documentation
Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses.
Pascal-based TeX scans for the first period, C TeX uses the last. No period is retained immediately before SUFFIX, so normally SUFFIX starts with one.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
(defun tex-append (file-name suffix)
"Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses.
Pascal-based TeX scans for the first period, C TeX uses the last.
No period is retained immediately before SUFFIX,
so normally SUFFIX starts with one."
(if (stringp file-name)
(let ((file (file-name-nondirectory file-name))
trial-name)
;; Try splitting on last period.
;; The first-period split can get fooled when two files
;; named a.tex and a.b.tex are both tex'd;
;; the last-period split must be right if it matches at all.
(setq trial-name
(concat (file-name-directory file-name)
(substring file 0
(string-match "\\.[^.]*$" file))
suffix))
(if (or (file-exists-p trial-name)
(file-exists-p (concat trial-name ".aux"))) ;for BibTeX files
trial-name
;; Not found, so split on first period.
(concat (file-name-directory file-name)
(substring file 0
(string-search "." file))
suffix)))
" "))