unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Get report on which files are loading
@ 2003-05-18  0:41 Harry Putnam
  2003-05-18 15:13 ` Harry Putnam
       [not found] ` <mailman.6356.1053271291.21513.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Harry Putnam @ 2003-05-18  0:41 UTC (permalink / raw)


Some time back I got a tip from Kai G. about how to tell which files are
being loaded:
I have this loaded from a special file ~/whats_loading.el
;; make loaded files give a message [from Kai]
 (defadvice load (before debug-log activate)
  (message "(Tip from Kai G): Now loading: %s" (ad-get-arg 0)))

It reports on some files but not on others.
For example it doesn't report when site-start.el is loaded even
though the defadvice is loaded first (from the command line)
  emacs -l ~/whats_loading.el

I have this in site-start.el to see when it loads:
 (message "finished loading => /usr/local/share/emacs/site-lisp/site-start.el") (sit-for 1)

I see in  *Messages* buffer, stuff that indicate what is loading like this:

  Loading whats_loading.el (source)...
  Loading advice...done
  Loading whats_loading.el (source)...done
  (Tip from Kai G): Now loading: ~/.emacs-custom
  Loading ~/.emacs-custom...done
  Loading skeleton...done

(NOTE the defadvice doesn't report site-start.el but the `message'
  shows so it has been read)  
  finished loading => /usr/local/share/emacs/site-lisp/site-start.el
  (Tip from Kai G): Now loading: ~/.emacs
  
  [...]

  (Tip from Kai G): Now loading: ~/.abbrev_defs
  Loading ~/.abbrev_defs...done
  (Tip from Kai G): Now loading: default
  (Tip from Kai G): Now loading: ~/.abbrev_defs
  [...]

I'd like to put something in that message line that allows emacs to
know what it has just read and from where.  Something like the `%s'
operator in the defadvice.  So that if for some reason site-start.el
is put somewhere else the accurate path and file name will still be
reported in *Messages* buffer.  Something like:
 (message "finished loading => SOMETHING TO REPORT PATH and FNAME") (sit-for 1)

I couldn't get it right as to where to put the `%s' or if it will even
fit in this line of code.

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

* Re: Get report on which files are loading
       [not found] <mailman.6352.1053220313.21513.help-gnu-emacs@gnu.org>
@ 2003-05-18  8:33 ` Kai Großjohann
  0 siblings, 0 replies; 13+ messages in thread
From: Kai Großjohann @ 2003-05-18  8:33 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

>  (defadvice load (before debug-log activate)
>   (message "(Tip from Kai G): Now loading: %s" (ad-get-arg 0)))

Instead of (ad-get-arg 0), say (locate-library (ad-get-arg 0)).  That
will give you the absolute filename.
-- 
This line is not blank.

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

* Re: Get report on which files are loading
  2003-05-18  0:41 Get report on which files are loading Harry Putnam
@ 2003-05-18 15:13 ` Harry Putnam
       [not found] ` <mailman.6356.1053271291.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Harry Putnam @ 2003-05-18 15:13 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:


> ;; make loaded files give a message [from Kai]
>  (defadvice load (before debug-log activate)
>   (message "(Tip from Kai G): Now loading: %s" (ad-get-arg 0)))
>
> It reports on some files but not on others.
> For example it doesn't report when site-start.el is loaded even
> though the defadvice is loaded first (from the command line)
>   emacs -l ~/whats_loading.el
>
> I have this in site-start.el to see when it loads:
>  (message "finished loading => /usr/local/share/emacs/site-lisp/site-start.el") (sit-for 1)
>
> I see in  *Messages* buffer, stuff that indicate what is loading like this:

[...]

> I'd like to put something in that message line that allows emacs to
> know what it has just read and from where.  Something like the `%s'
> operator in the defadvice.  So that if for some reason site-start.el
> is put somewhere else the accurate path and file name will still be
> reported in *Messages* buffer.  Something like:
>  (message "finished loading => SOMETHING TO REPORT PATH and FNAME") (sit-for 1)
>
> I couldn't get it right as to where to put the `%s' or if it will even
> fit in this line of code.

kai.grossjohann@gmx.net (Kai Großjohann) writes:

> Harry Putnam <reader@newsguy.com> writes:
>
>>  (defadvice load (before debug-log activate)
>>   (message "(Tip from Kai G): Now loading: %s" (ad-get-arg 0)))
>
> Instead of (ad-get-arg 0), say (locate-library (ad-get-arg 0)).  That
> will give you the absolute filename.

 (defadvice load (before debug-log activate)
(message "(Tip from Kai G): Now loading: %s" (locate-library (ad-get-arg 0))))

Well, that gives absolute file names alright but I think I must have
confused the issue in my previous post.  The defadvice DOES NOT
report the loading of site-start.el even when the defadvice is
preloaded from the command line with
  emacs -l whats_loading.el

I don't understand why.  But to compensate for that lack of report I
put this at the end of site-start.el:

  (message "finished loading => /usr/local/share/emacs/site-lisp/site-start.el") (sit-for 1)

What I wanted to know was how to change that line so I don't have to
put the absolute filename manually.  In other words. How to make the
last `message' line above report absolute filename by itself
 (message "finished loading => "(SOMETHING HERE TO REPORT FILE NAME) (sit-for 1))

I want this because the defadvice DOES NOT report when site-start.el
is loaded.

Observe:
 emacs -l /usr/share/emacs/site-lisp/whats_loading.el &

 (`whats_loading.el' contains the defadvice as modified and shown above)
Notice in the output of *Messages* that loading of site start el is
NOT reported by the defadvice.  The only indication is the message
line shown above at the end of site-start.el:

  emacs -l /usr/local/share/emacs/site-lisp/whats_loading.el &
*Messages*:

Loading disp-table...done
Loading encoded-kb...done
Loading tool-bar...done
Loading image...done
Loading tooltip...done
Loading whats_loading.el (source)...
Loading advice...done
Loading whats_loading.el (source)...done
Loading help-fns...done
(Tip from Kai G): Now loading: /home/reader/.emacs-custom
Loading ~/.emacs-custom...done
Loading skeleton...done
Loading executable...done
Loading regexp-opt...done
finished loading => /usr/local/share/emacs/site-lisp/site-start.el
(Tip from Kai G): Now loading: /home/reader/.emacs
Loading bbdb-gnus...
Loading easymenu...done
[...]

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

* Re: Get report on which files are loading
       [not found] ` <mailman.6356.1053271291.21513.help-gnu-emacs@gnu.org>
@ 2003-05-18 15:45   ` Kai Großjohann
  2003-05-18 22:14     ` Harry Putnam
  2003-05-18 18:09   ` Stefan Monnier
  2003-05-19 19:16   ` Kevin Rodgers
  2 siblings, 1 reply; 13+ messages in thread
From: Kai Großjohann @ 2003-05-18 15:45 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

> I don't understand why.  But to compensate for that lack of report I
> put this at the end of site-start.el:
>
>   (message "finished loading => /usr/local/share/emacs/site-lisp/site-start.el") (sit-for 1)
>
> What I wanted to know was how to change that line so I don't have to
> put the absolute filename manually.  In other words. How to make the
> last `message' line above report absolute filename by itself
>  (message "finished loading => "(SOMETHING HERE TO REPORT FILE NAME) (sit-for 1))

Ah!  That's what you want.  Sorry, I misunderstood.

I don't know how to find out the file name you're in.  But you can
add the full path of site-start.el, like so:

(message "finished loading => %s" (locate-library "site-start"))

-- 
This line is not blank.

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

* Re: Get report on which files are loading
       [not found] ` <mailman.6356.1053271291.21513.help-gnu-emacs@gnu.org>
  2003-05-18 15:45   ` Kai Großjohann
@ 2003-05-18 18:09   ` Stefan Monnier
  2003-05-18 22:14     ` Harry Putnam
  2003-05-19 19:16   ` Kevin Rodgers
  2 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2003-05-18 18:09 UTC (permalink / raw)


>  (message "finished loading => "(SOMETHING HERE TO REPORT FILE NAME) (sit-for 1))

You might want to try the `load-file-name' variable.


        Stefan

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

* Re: Get report on which files are loading
  2003-05-18 18:09   ` Stefan Monnier
@ 2003-05-18 22:14     ` Harry Putnam
  2003-05-18 23:36       ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Harry Putnam @ 2003-05-18 22:14 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

>>  (message "finished loading => "(SOMETHING HERE TO REPORT FILE NAME) (sit-for 1))
>
> You might want to try the `load-file-name' variable.

C-h v shows nil for that var but not sure how one would use it in
lisp `message' to announce the current file name.
Is it something like the shell $0 operator or its shortened version
$(basename $0)?

Can you show a simple usage?

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

* Re: Get report on which files are loading
  2003-05-18 15:45   ` Kai Großjohann
@ 2003-05-18 22:14     ` Harry Putnam
  0 siblings, 0 replies; 13+ messages in thread
From: Harry Putnam @ 2003-05-18 22:14 UTC (permalink / raw)


kai.grossjohann@gmx.net (Kai Großjohann) writes:

> (message "finished loading => %s" (locate-library "site-start"))

yeah yeah, now were talking.

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

* Re: Get report on which files are loading
  2003-05-18 22:14     ` Harry Putnam
@ 2003-05-18 23:36       ` Stefan Monnier
  2003-05-19  5:13         ` Harry Putnam
  2003-05-19 13:51         ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2003-05-18 23:36 UTC (permalink / raw)


>>> (message "finished loading => "(SOMETHING HERE TO REPORT FILE NAME) (sit-for 1))
>> You might want to try the `load-file-name' variable.
> C-h v shows nil for that var

Where you loading a file while you hit C-h v ?  Didn't think so !

> lisp `message' to announce the current file name.
> Is it something like the shell $0 operator or its shortened version
> $(basename $0)?
> Can you show a simple usage?

 (message "finished loading %s" load-file-name)


        Stefan

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

* Re: Get report on which files are loading
  2003-05-18 23:36       ` Stefan Monnier
@ 2003-05-19  5:13         ` Harry Putnam
  2003-05-19 13:51         ` Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Harry Putnam @ 2003-05-19  5:13 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

>> Can you show a simple usage?
>
>  (message "finished loading %s" load-file-name)

Well geez, thats no fun... where are the acres of complicated parens,
single quotes etc. .. he he.

And yes as you guessed I completely misunderstood its usage...
...Thanks

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

* Re: Get report on which files are loading
  2003-05-18 23:36       ` Stefan Monnier
  2003-05-19  5:13         ` Harry Putnam
@ 2003-05-19 13:51         ` Stefan Monnier
  2003-05-19 14:39           ` Harry Putnam
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2003-05-19 13:51 UTC (permalink / raw)


> Where you loading a file while you hit C-h v ?  Didn't think so !
   ^

How embarassing!


        Stefan

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

* Re: Get report on which files are loading
  2003-05-19 13:51         ` Stefan Monnier
@ 2003-05-19 14:39           ` Harry Putnam
  0 siblings, 0 replies; 13+ messages in thread
From: Harry Putnam @ 2003-05-19 14:39 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

>> Where you loading a file while you hit C-h v ?  Didn't think so !
>    ^
>
> How embarassing!

Had you just left it alone... no one but the absolute most observant
would have noticed...  You could have gotten away without having to
undergo all that shame...

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

* Re: Get report on which files are loading
       [not found] ` <mailman.6356.1053271291.21513.help-gnu-emacs@gnu.org>
  2003-05-18 15:45   ` Kai Großjohann
  2003-05-18 18:09   ` Stefan Monnier
@ 2003-05-19 19:16   ` Kevin Rodgers
  2003-05-19 23:32     ` Harry Putnam
  2 siblings, 1 reply; 13+ messages in thread
From: Kevin Rodgers @ 2003-05-19 19:16 UTC (permalink / raw)


Harry Putnam wrote:

> (defadvice load (before debug-log activate)
>   (message "(Tip from Kai G): Now loading: %s" (locate-library (ad-get-arg 0))))
> 
> Well, that gives absolute file names alright but I think I must have
> confused the issue in my previous post.  The defadvice DOES NOT
> report the loading of site-start.el even when the defadvice is
> preloaded from the command line with
>   emacs -l whats_loading.el

Because command line options like -l whats_loading.el are processed after the
site-start.el, ~/.emacs, and default.el init files.  See the "Action Arguments"
and "Init File" nodes of the Emacs manual.

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: Get report on which files are loading
  2003-05-19 19:16   ` Kevin Rodgers
@ 2003-05-19 23:32     ` Harry Putnam
  0 siblings, 0 replies; 13+ messages in thread
From: Harry Putnam @ 2003-05-19 23:32 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Harry Putnam wrote:
>
>> (defadvice load (before debug-log activate)
>>   (message "(Tip from Kai G): Now loading: %s" (locate-library (ad-get-arg 0))))
>> Well, that gives absolute file names alright but I think I must have
>> confused the issue in my previous post.  The defadvice DOES NOT
>> report the loading of site-start.el even when the defadvice is
>> preloaded from the command line with
>>   emacs -l whats_loading.el
>
> Because command line options like -l whats_loading.el are processed after the
> site-start.el, ~/.emacs, and default.el init files.  See the "Action Arguments"
> and "Init File" nodes of the Emacs manual.

Thanks Kevin, yes I had finally smartened up and put a lisp message
at beginning and end of site-start.el so I saw exactly what you point
out.  A file loaded from the command line is still read after site-start.el

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

end of thread, other threads:[~2003-05-19 23:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-18  0:41 Get report on which files are loading Harry Putnam
2003-05-18 15:13 ` Harry Putnam
     [not found] ` <mailman.6356.1053271291.21513.help-gnu-emacs@gnu.org>
2003-05-18 15:45   ` Kai Großjohann
2003-05-18 22:14     ` Harry Putnam
2003-05-18 18:09   ` Stefan Monnier
2003-05-18 22:14     ` Harry Putnam
2003-05-18 23:36       ` Stefan Monnier
2003-05-19  5:13         ` Harry Putnam
2003-05-19 13:51         ` Stefan Monnier
2003-05-19 14:39           ` Harry Putnam
2003-05-19 19:16   ` Kevin Rodgers
2003-05-19 23:32     ` Harry Putnam
     [not found] <mailman.6352.1053220313.21513.help-gnu-emacs@gnu.org>
2003-05-18  8:33 ` Kai Großjohann

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