unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to get recursive load level?
@ 2013-09-14 21:19 Michael Heerdegen
  2013-09-15  5:27 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2013-09-14 21:19 UTC (permalink / raw)
  To: emacs-devel

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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get recursive load level?
  2013-09-14 21:19 How to get recursive load level? Michael Heerdegen
@ 2013-09-15  5:27 ` Stefan Monnier
  2013-09-15 16:15   ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2013-09-15  5:27 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

> 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))
[...]
> tree.  This is very fragile - can it be done better?  Please also

That sounds like a reasonable solution.
There are other hacks possible, such as advising load, of course, or
using backtrace-frame (see code around macroexp--trim-backtrace-frame).


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get recursive load level?
  2013-09-15  5:27 ` Stefan Monnier
@ 2013-09-15 16:15   ` Michael Heerdegen
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2013-09-15 16:15 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > 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))
> [...]
> > tree.  This is very fragile - can it be done better?  Please also
>
> That sounds like a reasonable solution.
> There are other hacks possible, such as advising load, of course, or
> using backtrace-frame (see code around macroexp--trim-backtrace-frame).

Ok, thanks.  I think I'll keep what I have, since the other hacks are
even hackier.


Regards,

Michael.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-15 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-14 21:19 How to get recursive load level? Michael Heerdegen
2013-09-15  5:27 ` Stefan Monnier
2013-09-15 16:15   ` Michael Heerdegen

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).