unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: emacs-devel@gnu.org
Subject: How to get recursive load level?
Date: Sat, 14 Sep 2013 23:19:37 +0200	[thread overview]
Message-ID: <87wqmj14pi.fsf@web.de> (raw)

Hello,

I want to show a tree of recently loaded elisp files in a log buffer.
The tree structure should show which file was loaded by another one.
For this purpose, it is sufficient to know the recursive load level of
each file (and the loading order, which is trivial).  Is there any mean
to get that information more or less directly?

I have a working, but ugly solution: to `after-load-functions' I add a
function like

(lambda (file)
  (push (cons load-file-name file) temp-load-hist))

When the hook is run, `file' is bound to the file that was loaded, and
`load-file-name' to the file that loaded it, or nil when it was loaded
directly.  Afterwards, I scan `temp-load-hist' and reconstruct the load
tree.  This is very fragile - can it be done better?  Please also
answer when you think "no".

Second question: is there a mean to run a function directly before a
file is loaded?  I don't want to advice `load', and there is no hook.
Because I would want to write

  Loading ...

rather than afterwards

  Loaded ...

in my log buffer.


Thanks,

Michael.




             reply	other threads:[~2013-09-14 21:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14 21:19 Michael Heerdegen [this message]
2013-09-15  5:27 ` How to get recursive load level? Stefan Monnier
2013-09-15 16:15   ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wqmj14pi.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).