I am looking to include a reference to a non-elisp file (a small Python program), and would like to be able to say "it is in the same directory as the current file, but with a different file name." In many scripting languages, there are things like __FILE__
(in PHP) for getting an absolute path to the current file.
If the file to be included is in the load-path
, then I can find it with (locate-library "file.py" t)
, but I'm kind of stuck if the file is not in the load path.
So is there a way for an Emacs Lisp file to find out its own absolute path (when being loaded, not visited)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…