Function: reftex-find-file-on-path

reftex-find-file-on-path is a byte-compiled function defined in reftex.el.gz.

Signature

(reftex-find-file-on-path FILE PATH &optional DEF-DIR)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex.el.gz
(defun reftex-find-file-on-path (file path &optional def-dir)
  ;; Find FILE along the directory list PATH.
  ;; DEF-DIR is the default directory for expanding relative path elements.
  (catch 'exit
    (when (file-name-absolute-p file)
      (if (file-regular-p file)
          (throw 'exit file)
        (throw 'exit nil)))
    (let* ((thepath path) file1 dir)
      (while (setq dir (pop thepath))
        (when (string= (substring dir -2) "//")
          (setq dir (substring dir 0 -1)))
        (setq file1 (expand-file-name file (expand-file-name dir def-dir)))
        (if (file-regular-p file1)
            (throw 'exit file1)))
      ;; No such file
      nil)))