From within a lisp file being loaded and run with emacs -l path/to/script/foo.el
can I get the path to file being run?
For example, is there some way to determine what path/to/script
is from within foo.el
?
I am not very experienced with lisp so please be gentle with your solutions.
Emacs 22.3.1 on Windows 7
The variable load-file-name
is bound to the name of the file as it is being loaded. To get the directory, you'd just use file-name-directory
, like so:
(file-name-directory load-file-name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With