2009-06-24

emacs lisp's executing script name $0

On Jun 24, 9:20 pm, Harry Putnam wrote:
> How does elisp reference the current *.el file?... I mean like in the
> way that the variable $0 carries the the value that is the full name
> of the script its in.
> What I'm really after is a say to to add that value to a message
> ('(message "hello")')
>
> Like this message (wrapped for mail):
>
> (message "hello world -- from
> /cvsb/reader/home/reader/lisp/site-start.el")
> (sit-for 1)
>
> that I use sometimes when tracking down how things are loading.
>
> How can I reference the name in a variable instead of writing it out?

you can use this:
(or load-file-name buffer-file-name)

if you want the full path, call file-name-directory on the result.

Xah
∑ http://xahlee.org/

No comments:

Post a Comment