[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Failing to advice `require'
From: |
Sebastien Vauban |
Subject: |
Failing to advice `require' |
Date: |
Mon, 20 Aug 2012 17:30:23 +0200 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (windows-nt) |
Hello,
I tried to advice the require function, in order to get:
- performance information (load time)
- call graph of `require'
with the following code:
--8<---------------cut here---------------start------------->8---
(defvar my/require-depth 0)
(defadvice require (around require-around activate)
"Leave a trace of packages being loaded."
(let ((feature (ad-get-arg 0))
(filename (ad-get-arg 1))
(noerror (ad-get-arg 2))
(prefix (concat (make-string (* 2 my/require-depth) ? ) "+-> ")))
(setq my/require-depth (1+ my/require-depth))
(cond ((featurep feature)
(message "(info) %sRequiring `%s'... already loaded"
prefix feature)
)
(t
(let ((my/time-start))
(message "(info) %sRequiring `%s'..." prefix feature)
(setq my/time-start (float-time))
ad-do-it
(message "(info) %sRequiring `%s'... %s (loaded in %.2f s)"
prefix feature
(locate-library (symbol-name feature))
(- (float-time) my/time-start))
)))
(setq my/require-depth (1- my/require-depth))))
--8<---------------cut here---------------end--------------->8---
It works quite well, except for the following case:
--8<---------------cut here---------------start------------->8---
;; Requiring `auth-source'...
;; (info) +-> Requiring `password-cache'...
d:/home/sva/Downloads/emacs/site-lisp/gnus/lisp/password-cache.elc (loaded in
0.11 s)
;; (info) +-> Requiring `mm-util'... already loaded
;; (info) +-> Requiring `gnus-util'... already loaded
;; (info) +-> Requiring `eieio'... already loaded [2 times]
;; byte-code: eieio not found in `load-path' or gnus-fallback-lib/ directory.
--8<---------------cut here---------------end--------------->8---
Guess what? `eieio' is in my default load path, in my GNU Emacs 24.1.1
(i386-mingw-nt5.1.2600) of 2012-06-02 on MARVIN on Windows XP.
Do you have any idea why it's failing?
Best regards,
Seb
--
Sebastien Vauban
- Failing to advice `require',
Sebastien Vauban <=