Function: check-declare-locate
check-declare-locate is a byte-compiled function defined in
check-declare.el.gz.
Signature
(check-declare-locate FILE BASEFILE)
Documentation
Return the relative name of FILE.
Expands files with a ".c" or ".m" extension relative to the Emacs
"src/" directory. Otherwise, locate-library searches for FILE.
If that fails, expands FILE relative to BASEFILE's directory part.
The returned file might not exist. If FILE has an "ext:" prefix, so does
the result.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/check-declare.el.gz
(defun check-declare-locate (file basefile)
"Return the relative name of FILE.
Expands files with a \".c\" or \".m\" extension relative to the Emacs
\"src/\" directory. Otherwise, `locate-library' searches for FILE.
If that fails, expands FILE relative to BASEFILE's directory part.
The returned file might not exist. If FILE has an \"ext:\" prefix, so does
the result."
(let ((ext (string-match "^ext:" file))
tfile)
(if ext
(setq file (substring file 4)))
(setq file
(if (member (file-name-extension file) '("c" "m"))
(expand-file-name file (expand-file-name "src" source-directory))
(if (setq tfile (locate-library file))
(progn
(setq tfile
(replace-regexp-in-string "\\.elc\\'" ".el" tfile))
(if (and (not (file-exists-p tfile))
(file-exists-p (concat tfile ".gz")))
(concat tfile ".gz")
tfile))
(setq tfile (expand-file-name file
(file-name-directory basefile)))
(if (or (file-exists-p tfile)
(string-match "\\.el\\'" tfile))
tfile
(concat tfile ".el")))))
(setq file (file-relative-name file))
(if ext (concat "ext:" file)
file)))