Function: ffap-locate-file
ffap-locate-file is a byte-compiled function defined in ffap.el.gz.
Signature
(ffap-locate-file FILE NOSUFFIX PATH)
Documentation
A generic path-searching function.
Returns the name of file in PATH, or nil.
Optional NOSUFFIX, if nil or t, is like the fourth argument
for load: whether to try the suffixes (".elc" ".el" "").
If a nonempty list, it is a list of suffixes to try instead.
PATH is a list of directories.
This uses ffap-file-exists-string, which may try adding suffixes from
ffap-compression-suffixes.
Source Code
;; Defined in /usr/src/emacs/lisp/ffap.el.gz
(defun ffap-locate-file (file nosuffix path)
;; The current version of locate-library could almost replace this,
;; except it does not let us override the suffix list. The
;; compression-suffixes search moved to ffap-file-exists-string.
"A generic path-searching function.
Returns the name of file in PATH, or nil.
Optional NOSUFFIX, if nil or t, is like the fourth argument
for `load': whether to try the suffixes (\".elc\" \".el\" \"\").
If a nonempty list, it is a list of suffixes to try instead.
PATH is a list of directories.
This uses `ffap-file-exists-string', which may try adding suffixes from
`ffap-compression-suffixes'."
(if (file-name-absolute-p file)
(setq path (list (file-name-directory file))
file (file-name-nondirectory file)))
(let ((dir-ok (equal "" (file-name-nondirectory file)))
(suffixes-to-try
(cond
((consp nosuffix) nosuffix)
(nosuffix '(""))
(t '(".elc" ".el" ""))))
suffixes try found)
(while path
(setq suffixes suffixes-to-try)
(while suffixes
(setq try (ffap-file-exists-string
(expand-file-name
(concat file (car suffixes)) (car path))))
(if (and try (or dir-ok (not (file-directory-p try))))
(setq found try suffixes nil path nil)
(setq suffixes (cdr suffixes))))
(setq path (cdr path)))
found))