51 |
(error "%S is not a currently loaded feature" feature) |
(error "%S is not a currently loaded feature" feature) |
52 |
(car (feature-symbols feature)))) |
(car (feature-symbols feature)))) |
53 |
|
|
54 |
|
(defun file-loadhist-lookup (file) |
55 |
|
"Return the `load-history' element for FILE." |
56 |
|
;; First look for FILE as given. |
57 |
|
(let ((symbols (assoc file load-history))) |
58 |
|
;; Try converting a library name to an absolute file name. |
59 |
|
(and (null symbols) |
60 |
|
(let ((absname (find-library-name file))) |
61 |
|
(if (not (equal absname file)) |
62 |
|
(setq symbols (cdr (assoc absname load-history)))))) |
63 |
|
;; Try converting an absolute file name to a library name. |
64 |
|
(and (null symbols) (string-match "[.]el\\'" file) |
65 |
|
(let ((libname (file-name-nondirectory file))) |
66 |
|
(string-match "[.]el\\'" libname) |
67 |
|
(setq libname (substring libname 0 (match-beginning 0))) |
68 |
|
(setq symbols (cdr (assoc libname load-history))))) |
69 |
|
symbols)) |
70 |
|
|
71 |
(defun file-provides (file) |
(defun file-provides (file) |
72 |
"Return the list of features provided by FILE." |
"Return the list of features provided by FILE." |
73 |
(let ((symbols (cdr (assoc file load-history))) |
(let ((symbols (file-loadhist-lookup file)) |
74 |
provides) |
provides) |
75 |
(mapc (lambda (x) |
(mapc (lambda (x) |
76 |
(if (and (consp x) (eq (car x) 'provide)) |
(if (and (consp x) (eq (car x) 'provide)) |
80 |
|
|
81 |
(defun file-requires (file) |
(defun file-requires (file) |
82 |
"Return the list of features required by FILE." |
"Return the list of features required by FILE." |
83 |
(let ((symbols (cdr (assoc file load-history))) |
(let ((symbols (file-loadhist-lookup file)) |
84 |
requires) |
requires) |
85 |
(mapc (lambda (x) |
(mapc (lambda (x) |
86 |
(if (and (consp x) (eq (car x) 'require)) |
(if (and (consp x) (eq (car x) 'require)) |